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
https://forums.phpfreaks.com/topic/212129-problem-with-sql/
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
https://forums.phpfreaks.com/topic/212129-problem-with-sql/#findComment-1105458
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.