Thomisback Posted April 2, 2008 Share Posted April 2, 2008 Hi again, sorry having a bad day with querys I guess... <?php $rCrime = mysql_query('SELECT id,auto,geld,wapen,chauffeur,wapenexpert FROM $oc WHERE gamename='$prefix' AND id = '.intval($_GET['id']).' AND leader = "'.$data->login.'"'); $aCrime = mysql_fetch_object($rCrime); $iCrime = mysql_num_rows($rCrime); ?> This line causes the error: <?php Parse error: syntax error, unexpected T_VARIABLE ?> I already tried changing "s, 's, etcetera but can't figure it out, if anyone knows how to do this it would be great! Thanks everyone again ~ Thomisback Link to comment https://forums.phpfreaks.com/topic/99183-solved-mysql-query-again/ Share on other sites More sharing options...
truck7758 Posted April 2, 2008 Share Posted April 2, 2008 $rCrime = mysql_query('SELECT id,auto,geld,wapen,chauffeur,wapenexpert FROM ".$oc." WHERE gamename='".$prefix."' AND id = '.intval($_GET['id']).' AND leader = "'.$data->login.'"'); try that Link to comment https://forums.phpfreaks.com/topic/99183-solved-mysql-query-again/#findComment-507439 Share on other sites More sharing options...
Thomisback Posted April 2, 2008 Author Share Posted April 2, 2008 Thanks for your help unfortunately I get the following: Parse error: syntax error, unexpected '"' in Seems there is something wrong at the end Link to comment https://forums.phpfreaks.com/topic/99183-solved-mysql-query-again/#findComment-507446 Share on other sites More sharing options...
truck7758 Posted April 2, 2008 Share Posted April 2, 2008 Parse error: syntax error, unexpected '"' in is that the whole error message? Link to comment https://forums.phpfreaks.com/topic/99183-solved-mysql-query-again/#findComment-507451 Share on other sites More sharing options...
Thomisback Posted April 2, 2008 Author Share Posted April 2, 2008 Parse error: syntax error, unexpected '"' in is that the whole error message? Parse error: syntax error, unexpected '"' in D:\xampplite\htdocs\x\x.php on line 124 That is the whole error message... Link to comment https://forums.phpfreaks.com/topic/99183-solved-mysql-query-again/#findComment-507454 Share on other sites More sharing options...
truck7758 Posted April 2, 2008 Share Posted April 2, 2008 $rCrime = mysql_query("SELECT id,auto,geld,wapen,chauffeur,wapenexpert FROM ".$oc." WHERE gamename='".$prefix."' AND id = '.intval($_GET['id']).' AND leader = '".$data->login."';"); try that. this is almost the same as a query i have running and that works fine Link to comment https://forums.phpfreaks.com/topic/99183-solved-mysql-query-again/#findComment-507460 Share on other sites More sharing options...
uniflare Posted April 2, 2008 Share Posted April 2, 2008 the reason you had a unexpected variable parse error was because you were using single quotes ' so when you wrapped your variables in single quotes it ended the string, and made a parse error. Basically you forgot to concatenate $oc and $prefix properly: <?php $rCrime = mysql_query('SELECT id,auto,geld,wapen,chauffeur,wapenexpert FROM '.$oc.' WHERE gamename=\''.$prefix.'\' AND id = \''.intval($_GET['id']).'\' AND leader = \''.$data->login.'\''); $aCrime = mysql_fetch_object($rCrime); $iCrime = mysql_num_rows($rCrime); ?> hope this helps, Link to comment https://forums.phpfreaks.com/topic/99183-solved-mysql-query-again/#findComment-507472 Share on other sites More sharing options...
Thomisback Posted April 2, 2008 Author Share Posted April 2, 2008 Wow, thanks! I never realized that... Thanks again! I will remember it if I get anymore similar problems Link to comment https://forums.phpfreaks.com/topic/99183-solved-mysql-query-again/#findComment-507477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.