Thomisback Posted April 2, 2008 Share Posted April 2, 2008 I know it has already been asked a lot of times & of course I googled this error first but could not figure out the answer. The line which gives me the error is: $rOCrime = mysql_query('SELECT wapenexpert,leader,chauffeur,auto,wapen FROM $oc WHERE gamename='$prefix' AND id = '.intval($_GET['id'])); If anyone knows how to fix this, please let me know! Thank you, ~ Thomisback Link to comment https://forums.phpfreaks.com/topic/99155-solved-parse-error-syntax-error-unexpected-t_variable/ Share on other sites More sharing options...
budimir Posted April 2, 2008 Share Posted April 2, 2008 This is the problem in your query ... FROM $oc WHERE.... It needs to say ... FROM tablename WHERE.... Link to comment https://forums.phpfreaks.com/topic/99155-solved-parse-error-syntax-error-unexpected-t_variable/#findComment-507292 Share on other sites More sharing options...
ToonMariner Posted April 2, 2008 Share Posted April 2, 2008 You are having a couple of problems with your quotes.... try this... <?php $qry = "SELECT wapenexpert,leader,chauffeur,auto,wapen FROM " . $oc . " WHERE gamename='" . $prefix . "' AND id = " . intval($_GET['id']); $rOCrime = mysql_query($qry); ?> Much easier to read what you are trying to do This method you can echo out your query to check errors in your mysql admin app... Link to comment https://forums.phpfreaks.com/topic/99155-solved-parse-error-syntax-error-unexpected-t_variable/#findComment-507293 Share on other sites More sharing options...
Thomisback Posted April 2, 2008 Author Share Posted April 2, 2008 You are having a couple of problems with your quotes.... try this... <?php $qry = "SELECT wapenexpert,leader,chauffeur,auto,wapen FROM " . $oc . " WHERE gamename='" . $prefix . "' AND id = " . intval($_GET['id']); $rOCrime = mysql_query($qry); ?> Much easier to read what you are trying to do This method you can echo out your query to check errors in your mysql admin app... Thanks a lot, that worked! Sadly I have got another error in this file now, it is a similar one to the one above, I will try to figure it out. <?php mysql_query("UPDATE " . $oc . " SET wapen = '.$iWapen.' WHERE gamename='" . $prefix . "' AND id = " . intval($_GET['id']); ?> But I get: Parse error: syntax error, unexpected ';' I don't see what's wrong with my code... I think I missed out (several) "s? Link to comment https://forums.phpfreaks.com/topic/99155-solved-parse-error-syntax-error-unexpected-t_variable/#findComment-507299 Share on other sites More sharing options...
Thomisback Posted April 2, 2008 Author Share Posted April 2, 2008 Got it working: mysql_query("UPDATE " . $oc . " SET wapen = '.$iWapen.' WHERE gamename='" . $prefix . "' AND id = " . intval($_GET['id'])); Link to comment https://forums.phpfreaks.com/topic/99155-solved-parse-error-syntax-error-unexpected-t_variable/#findComment-507302 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.