DEVILofDARKNESS Posted April 25, 2009 Share Posted April 25, 2009 I don't see what's the problem in this: I already had an error in line 1 before, and by changing something in line 7 it was solved, so look carefully at whole the code, maybe you can see the problem? 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 '' at line 1 echo "<form action='' method='post'><table border='1' height='100% width='100%'> <tr><td><b><u>Technology Name</td><td><u><b>Technology Level</u></b></td><td><u><b>Type</u></b></td><td><u><b>Costs</u></b></td><td><u><b>Needs</u></b></td></tr>"; $getOwnOffLvl = mysql_query("SELECT offensive_level FROM nations WHERE nation_id = '$nationid'") or die(mysql_error()); list($OwnOffLvl) = mysql_fetch_row($getOwnOffLvl); $getOwnDefLvl = mysql_query("SELECT defensive_level FROM nations WHERE nation_id = '$nationid'") or die(mysql_error()); list($OwnDefLvl) = mysql_fetch_row($getOwnDefLvl); $getTechnologies = mysql_query("SELECT * FROM technologies WHERE (((level = '$OwnOffLvl' + 1) AND (type = 'offensive')) Or (((level = '$OwnDefLvl' + 1) AND (type = 'defensive')))") or die(mysql_error()); while($technologies = mysql_fetch_array($getTechnologies)) { echo "<tr><td>" . $technologies['name'] . "</td><td>" . $technologies['level'] . "</td><td>" . $technologies['type'] . "</td><td>" . $technologies['cost'] . "</td><td>" . $technologies['need'] . "</td></tr>"; } echo "</table></form>"; Link to comment https://forums.phpfreaks.com/topic/155628-solved-problem-in-your-sql-syntax-near-row-1/ Share on other sites More sharing options...
Mchl Posted April 25, 2009 Share Posted April 25, 2009 Carefully count the parentheses in this query. SELECT * FROM technologies WHERE (((level = '$OwnOffLvl' + 1) AND (type = 'offensive')) Or (((level = '$OwnDefLvl' + 1) AND (type = 'defensive'))) Link to comment https://forums.phpfreaks.com/topic/155628-solved-problem-in-your-sql-syntax-near-row-1/#findComment-819166 Share on other sites More sharing options...
DEVILofDARKNESS Posted April 25, 2009 Author Share Posted April 25, 2009 I thought I had count it right , I didn't Thanks. Link to comment https://forums.phpfreaks.com/topic/155628-solved-problem-in-your-sql-syntax-near-row-1/#findComment-819174 Share on other sites More sharing options...
Mchl Posted April 25, 2009 Share Posted April 25, 2009 Apart from having one missing, you also have at least one unnecessary pair. Link to comment https://forums.phpfreaks.com/topic/155628-solved-problem-in-your-sql-syntax-near-row-1/#findComment-819177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.