Re: Further help for PHP, SQL syntax, and register_globals

From: Date: Tue, 26 Oct 2004 11:01:23 +0000
Subject: Re: Further help for PHP, SQL syntax, and register_globals
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-200330@lists.php.net to get a copy of this message
Sugimoto wrote:
Bad query: You have an error in your SQL syntax near 'and Tit like and Aut like and Auty like ' at line 4 [snip]
foreach ($_GET as $value) {
     if (empty($value)) $value = "%";
You have an issue here. You're looping through $_GET and attempting to set a default value (which is good), but you're not making any changes to $_GET at all, just resetting the same $value variable to '%'. foreach($_GET as $key=>$value) { if(empty($value)) { $_GET[$key] = '%'; } } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#200330) next »