RE: [PHP-DB] Dynamic SQL + result resource error

From: Date: Mon, 09 Jul 2001 00:19:48 +0000
Subject: RE: [PHP-DB] Dynamic SQL + result resource error
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10161@lists.php.net to get a copy of this message
Ha ha... I should have meantioned "Here's what it -should- be" or something of the like. :) I suspect that was the only problem with his code, but perhaps there's something else there. -----Original Message----- From: Ben Bleything [mailto:bleythbe@mailbox.orst.edu] Sent: Sunday, July 08, 2001 8:13 PM To: 'Matthew Loff'; 'Mark Gordon'; php-db@lists.php.net Subject: RE: [PHP-DB] Dynamic SQL + result resource error Guess I'm just a big dumbass then, aren't I =P Oops. I suppose that would cause it to fail then, wouldn't it? => Ben -----Original Message----- From: Matthew Loff [mailto:matt@willetts.com] Sent: Sunday, July 08, 2001 5:10 PM To: 'Ben Bleything'; 'Mark Gordon'; php-db@lists.php.net Subject: RE: [PHP-DB] Dynamic SQL + result resource error The code you're referencing is my modification of his original post. :) -----Original Message----- From: Ben Bleything [mailto:bleythbe@mailbox.orst.edu] Sent: Sunday, July 08, 2001 8:04 PM To: 'Matthew Loff'; 'Mark Gordon'; php-db@lists.php.net Subject: RE: [PHP-DB] Dynamic SQL + result resource error Sure he is. Right here: $queryResult = mysql_query($sql); what exact error is occurring? -----Original Message----- From: Matthew Loff [mailto:matt@willetts.com] Sent: Sunday, July 08, 2001 5:00 PM To: 'Mark Gordon'; php-db@lists.php.net Subject: RE: [PHP-DB] Dynamic SQL + result resource error You aren't calling mysql_query() to execute the query. //$find is text box input $wordsarray = explode(" ",$find); $sql = "SELECT bandname FROM bands WHERE (bandname LIKE "; $i = 0; while ($i < count($wordsarray)) { $word = current($wordsarray); next($wordsarray); $sql=$sql."$word)"; $i++; } print "$sql<hr>"; $queryResult = mysql_query($sql); while ($myrow=mysql_fetch_row($queryResult)) { print "$myrow[0],<p>"; } -----Original Message----- From: Mark Gordon [mailto:eyesyte@yahoo.com] Sent: Sunday, July 08, 2001 7:54 PM To: php-db@lists.php.net Subject: [PHP-DB] Dynamic SQL + result resource error Why is this code generating an error when it outputs a valid SQL statement? (there are no parse errors) //$find is text box input $wordsarray = explode(" ",$find); $sql = "SELECT bandname FROM bands WHERE (bandname LIKE "; $i = 0; while ($i < count($wordsarray)) { $word = current($wordsarray); next($wordsarray); $sql=$sql."$word)"; $i++; } print "$sql<hr>"; while ($myrow=mysql_fetch_row($sql)) { print "$myrow[0],<p>"; } ===== Mark eyesyte@yahoo.com __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ -- 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 -- 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 -- 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 (#10161) next »