MySQL Errors? Please Help!?

Question by murdok_007: 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 ‘Best answer:

Answer by Ghotherkill
Try this. This is what I always use:

$ con = mysql_connect(“localhost”,”root”) or die(mysql_error());
$ db = mysql_select_db(“answerthis”, $ con);

Know better? Leave your own answer in the comments!

No related content found.


There are no revisions for this post.

Tags: , , ,

3 Responses to “MySQL Errors? Please Help!?”

  1. Murali January 26, 2012 at 9:21 AM #

    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 “

  2. Daniel R January 26, 2012 at 10:18 AM #

    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.

  3. Peter K January 26, 2012 at 10:26 AM #

    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

Leave a Reply