Re: MySQL Query problem

From: Date: Sat, 10 May 2003 05:57:52 +0000
Subject: Re: MySQL Query problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147091@lists.php.net to get a copy of this message
> When I try: > > mysql_query("SELECT * FROM table WHERE something = '{$constraint}'"); > > (also tried without {}s) > > It fails, while when I try: > > mysql_query("SELECT * FROM table WHERE something = 'constraint'"); > > For all those who asked I /did/ echo out the string to show that it's > exactly the same thing. The same query that works when typed in but not > when I try any string concatonation (i.e. $query . $constraint . '\'')or > auto fill (using the variable in the string and letting it expand). > > So output is the same thing as a typed in string. Can anybody suggest a > possible fix? If you code your query with die() so you can see any sql errors: mysql_query("SELECT * FROM table WHERE something = 'constraint'") or die (mysql_error()); -- Greg Donald http://destiney.com/

« previous php.general (#147091) next »