Re: Mystery variable query?

From: Date: Thu, 03 May 2001 18:21:07 +0000
Subject: Re: Mystery variable query?
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-9108@lists.php.net to get a copy of this message
Hi guys, I'll answer this and the previous mail. First, thanks for the insight. 1. There is such a function as "mysql" whose arguments are mysql("database","query",[resource id]) very useful as it avoids having to call mysql_connect_db() As for printing the query, I had done that, and everything was fine. I have however, found the problem! (sorry about the waste of bandwidth, but maybe someone will avoid making the same mistake). The problem was not related to variable scope, but rather because the variable "1234" had some HTML formatting added to it somewhere in the script. The problem, evidently, is that echoing the variable didn't show the html formatting (it was something like "<font color=black>" in an obvious way! I wish there were a php debugger. Again, thanks for the suggestions, Martin "CC Zona" <cczona@nospam.invalid> wrote in message news:9cs5ef$6js$1@toye.p.sourceforge.net... > In article <9crr9l$4c4$1@toye.p.sourceforge.net>, > martinh@ureach.com ("martin helie") wrote: > > > assuming: > > > > $var="1234"; (type does not seem to matter) > > > > this query returns no error, but no result either: > > > > mysql("database","SELECT * FROM table WHERE id='$var'"); > > When you call mysql_query is it perhaps from inside a function, where > variable $var has not been passed or made global? > > (BTW, whenever you experience problems with a query, it's a good idea to > echo the query string to the browser. Often, this simple step makes it > very clear where the problem lies. Using mysql_error() and $php_errormsg > on a query failure also can give you very useful information.) > > -- > CC > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#9108) next »