PHP script not recognising mysql database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • truptivk
    New Member
    • Sep 2009
    • 14

    #1

    PHP script not recognising mysql database

    Hello all,

    I have written a simple PHP script that connects to a MySQL database and retrieves a record from a table. However, my script stop swith an error: 'Table yourdatabase.ta ble does not exist', whereas it does!

    I see the table when I execute 'show tables;' and also when I 'desc' it. I can also run select queries on it from within the MySQL command line. But somehow, the php script fails to. It connects to the database correctly. However, does not select from table.

    Any suggestions?

    Thanks,
    Trupti
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #2
    Do you have any errors and code to show us?

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      table is a reserved keyword in SQL. you should rename your table.

      Comment

      • truptivk
        New Member
        • Sep 2009
        • 14

        #4
        Thank you zorgi and Dormilich for taking the time out to reply; I really apppreciate it.

        I've been such a dimwit about the problem. Though my database is on the same machine, I gave the IP address of my machine in mysql_connect() instead of using NULL, or localhost or 127.0.0.1. I used localhost and now it work's just fine :)

        Dormilich, I have named my table something else and not table. I wrote it so over here just to illustrate :)

        Comment

        Working...