Re: letting a table name be a constant

From: Date: Tue, 24 Aug 2004 00:18:08 +0000
Subject: Re: letting a table name be a constant
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-35862@lists.php.net to get a copy of this message
On Aug 23, 2004, at 8:12 PM, John Holmes wrote:
You can't have a constant in a string. You'd do it like this: mysql_query("INSERT INTO " . TABLE . " (id,name) VALUES ('','$name')");
Thanks, John and Justin. Wasn't thinking about that.
The other error you have, and I don't know how you think this code runs, are the dollar signs before mysql_connect(), mysql_select_db() and mysql_query() are not needed.
You're right. It doesn't run. I retyped instead of copy-and-paste'd; that's a typo. Cheers, Ben

« previous php.db (#35862) next »