php - MySQL query parse error -


$week_leave = mysql_query("select count(id),leave.id `leave`, `users` leave.backgroundcolor = 'green' , leave.id=(select u_id `users` users.username='$_session['username']')"); 

gives following error:

parse error: syntax error, unexpected '' (t_encapsed_and_whitespace), expecting identifier (t_string) or variable (t_variable) or number (t_num_string)  

i know problem lies in sub query. suggestions ?

try have set data vetween curly braces {$_session['username']}

$week_leave = mysql_query("select count(id),leave.id `leave`, `users` leave.backgroundcolor = 'green' , leave.id=(select u_id `users` users.username='{$_session['username']}')"); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -