Jump to content

problem with sql


doddsey_65

Recommended Posts

i have the following sql running on local but i get an error.

 

the sql:

 

$sql = "SELECT * FROM '".TBL_PARENTS."'" or die(mysql_error());

 

the config file:

 

define('DB_PREFIX', 'forum_');
define('TBL_PARENTS', DB_PREFIX.'parents');

 

the error:

 

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 ''forum_parents'' at line 1

 

the echoed sql:

 

SELECT * FROM 'forum_parents'

 

as you can see when it is echoed it looks fine. Any ideas? The server im using is wamp server.

Link to comment
Share on other sites

Paste the actual code you're using. That doesn't appear to be it.

 

sorry i fixed it, instead of

 

$sql = "SELECT * FROM '".TBL_PARENTS."'" or die(mysql_error());

 

i used:

 

$sql = "SELECT * FROM ".DB_PREFIX."parents" or die(mysql_error());

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.