Friday, July 31, 2009

MySQL Errors? Please Help!?

#1064 - 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 '%26lt;?











define("DB_SERVER", "localhost")' at line 1














That's exactly what I get, and I'm not sure why. I don't have a ' after localhost"); , but that says I do. If I need to supply more information, please just email me and I will give the rest of the code, here's a small snippet





%26lt;?


/**


* Constants.php


*


* This file is intended to group all constants to


* make it easier for the site administrator to tweak


* the login script.


*


* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)


* Last Updated: August 19, 2004


*/





/**


* Database Constants - these constants are required


* in order for there to be a successful connection


* to the MySQL database. Make sure the information is


* correct.


*/


define("DB_SERVER", "localhost");


define("DB_USER", murdok_"Murdok");

MySQL Errors? Please Help!?
You haven't even executed any MySQL in this example so I don't know where the message comes from. The error will be in a call to something like mysql_query.





But while we are here the user line looks wrong. Probably should be


define("DB_USER","Murdok");
Reply:Try this. This is what I always use:





$con = mysql_connect("localhost","root") or die(mysql_error());


$db = mysql_select_db("answerthis", $con);
Reply:The problem is actually in the next line - murdok_ should be within quotes:


define("DB_USER", "murdok_Murdok");





Currently it is not valid PHP syntax, so the script can't read it.
Reply:define("DB_SERVER", "localhost");


define("DB_USER", murdok_"Murdok");





first what is this murdok_"Murdok".... its wrong...


remember mysql may not tell you precisely...where the error is.


murdok_"murdok"....what is this??


you are using a variable and a string constant with an underscore...!!!!


change this and try,,,





Also you have this "%26lt;?" as a top most line...


make sure this is not there in your file


No comments:

Post a Comment