php - Can't see parse error -


working on first php script interacts sql. i'm close can smell it!

i'm trying return max date in table , received following message date should be:

parse error: syntax error, unexpected t_variable in /applications/xampp/xamppfiles/htdocs/tslocal/themes/myname/views/reports/get_vote_date.php on line 25

line 25 $result = mysqli_query($dbc, $query);in script below.

here script, i've stared @ till eyes bleed there's uncertainty it's "wrong" because i'm new this:

<?php # script get_vote_date  // file contains db info // file establishes mysql connection, connects db , gets recent vote date particular page (incident_id).  define ('db_user', 'myname'); define ('db_password', 'somepass123'); define ('db_host', 'localhost'); define ('db_name', 'sitename');   // make db connection $dbc = @mysqli_connect('db_host','db_user','db_password','db_name')     or die ('could not connect mysql: ' . mysqli_connect_error());  // set encoding mysqli_set_charset($dbc, 'utf8');  // set query variable $query = 'select max(rating_date)            rating           incident_id = $incident_id;'  //connect , run query $result = mysqli_query($dbc, $query);   echo $result;  ?> 

if it's of value, here screen of table trying pull data from: enter image description here

the real error — missing (actually misplaced) semicolon — in previous statement:

$query = 'select max(rating_date)            rating           incident_id = $incident_id;' // <-- todo: put ; outside of string literal  //connect , run query $result = mysqli_query($dbc, $query);  

to php, syntactically looks

$query = "string" $result = mysqli_query(...);  

which of course parse error. note semicolon inside string literal has no special meaning php — not terminate statement (though produce sql error :) ).

unfortunately, php fails see intent on line 22 , detects error on line 25.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -