ask9 Posted June 9, 2011 Share Posted June 9, 2011 hi guys I know this is very basic. But this codes below has something wrong, $sql="select count('.$postConfig['id'].') as numRows from '$crudTableName' WHERE username='$username'"; Thanks in advanced. Link to comment https://forums.phpfreaks.com/topic/238884-parse-error-syntax-error-unexpected-t_encapsed_and_whitespace-expecting-t_str/ Share on other sites More sharing options...
Pikachu2000 Posted June 9, 2011 Share Posted June 9, 2011 $sql="SELECT COUNT( {$postConfig['id']} ) AS numRows FROM '$crudTableName' WHERE username = '$username'"; Link to comment https://forums.phpfreaks.com/topic/238884-parse-error-syntax-error-unexpected-t_encapsed_and_whitespace-expecting-t_str/#findComment-1227473 Share on other sites More sharing options...
ask9 Posted June 9, 2011 Author Share Posted June 9, 2011 @Pikachu2000 thanks, I copied your codes, and this is the new error below, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''orgs' WHERE username='solid9'' at line 1 Link to comment https://forums.phpfreaks.com/topic/238884-parse-error-syntax-error-unexpected-t_encapsed_and_whitespace-expecting-t_str/#findComment-1227476 Share on other sites More sharing options...
ask9 Posted June 9, 2011 Author Share Posted June 9, 2011 I fixed the problem with this codes below, $sql="select count({$postConfig['id']}) as numRows FROM $crudTableName WHERE username='$username'"; Link to comment https://forums.phpfreaks.com/topic/238884-parse-error-syntax-error-unexpected-t_encapsed_and_whitespace-expecting-t_str/#findComment-1227481 Share on other sites More sharing options...
Pikachu2000 Posted June 9, 2011 Share Posted June 9, 2011 I corrected the PHP parse error. The second one was a SQL syntax error, but I see you've figured that out . . . Link to comment https://forums.phpfreaks.com/topic/238884-parse-error-syntax-error-unexpected-t_encapsed_and_whitespace-expecting-t_str/#findComment-1227515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.