chris_2001 Posted November 27, 2007 Share Posted November 27, 2007 Could not run query: 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 'character WHERE name = 'Chris" at line 1 Im getting this error with this code. I think the problem is... 'Chris" (part in bold), but I can't fix it. Code below where error occures. $result = mysql_query("SELECT guid FROM character WHERE name = '".$user."'"); thanks in advance. Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/ Share on other sites More sharing options...
revraz Posted November 27, 2007 Share Posted November 27, 2007 Does $user contain bbcode? etc? Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/#findComment-400281 Share on other sites More sharing options...
chris_2001 Posted November 27, 2007 Author Share Posted November 27, 2007 Nope user is just text, in this case Chris Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/#findComment-400284 Share on other sites More sharing options...
revraz Posted November 27, 2007 Share Posted November 27, 2007 Try $result = mysql_query("SELECT `guid` FROM `character` WHERE `name` = '$user'"); Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/#findComment-400292 Share on other sites More sharing options...
PFMaBiSmAd Posted November 27, 2007 Share Posted November 27, 2007 CHARACTER is a reserved mysql keyword. Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/#findComment-400297 Share on other sites More sharing options...
chris_2001 Posted November 27, 2007 Author Share Posted November 27, 2007 CHARACTER is a reserved mysql keyword. Well the chart name I am trying to access is character, and that is not possable to change. Is there any way to get around this? Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/#findComment-400335 Share on other sites More sharing options...
revraz Posted November 27, 2007 Share Posted November 27, 2007 Read my post above. Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/#findComment-400337 Share on other sites More sharing options...
chris_2001 Posted November 28, 2007 Author Share Posted November 28, 2007 Read my post above. Doesnt work, now gives the error: Could not run query: 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 "character' WHERE name = 'Chris" at line 1 Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/#findComment-400697 Share on other sites More sharing options...
chris_2001 Posted November 28, 2007 Author Share Posted November 28, 2007 nevermind, my own stupidity Link to comment https://forums.phpfreaks.com/topic/79089-solved-error-in-you-sql-syntax/#findComment-400699 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.