Re: [PHP] Whimper, help :)
why '.$table.' and not '.$table.' with what you've got now, I believe you are looking for .table name. instead of table name and if your table name is only one word, a good practice I'm told, ditch the ' and marks entirely and just use ...FROM $table WHERE... also, use double quotes for start and end of variables as in: $sql=select * from '.$table.' where var='some value other than a number' ; Hope this helps Hugh We have met the enemy and they is us! Pogo - Original Message - From: John Taylor-Johnston [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, December 03, 2002 10:28 PM Subject: Re: [PHP] Whimper, help :) http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26qu ot%3B http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26qu ot%3B I blame PHP. Can't be MySQL. echo $sql displays the EXACT same thing. Debugging ... Works jdaxell.ccl = 2 records found: $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\'ready maria\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.test.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM .$table. WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.table.inc.phps :0 John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whimper, help :)
Hi, could you get the error message with mysql_error() and post it here? Bye, Bastian John Taylor-Johnston schrieb: http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26quot%3B http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B I blame PHP. Can't be MySQL. echo $sql displays the EXACT same thing. Debugging ... Works jdaxell.ccl = 2 records found: $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\'ready maria\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.test.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM .$table. WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.table.inc.phps :0 John -- Mit freundlichem Gruß i.A. Bastian Vogt + KomTel Gesellschaft fuer + Kommunikations- und + Informationsdienste mbH + + Bastian Vogt + Nordermarkt 1, D-24937 Flensburg + + Fon: +49-461-9090-00, Fax: +49-461-9090-031 + EMail: [EMAIL PROTECTED], Internet: http://www.komtel.net + + -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whimper, help :)
At 07:28 04.12.2002, John Taylor-Johnston said: [snip] Doesn't work - Resembles +ready +maria [snip] hmm - how do you get your string ready maria? The '+' signs are usually encoded blanks in a search argument. -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Whimper, help :)
Like I said, I can run the same SQL in PHPMyAdmin... Be careful when testing SQL statements containing (double)quotes in PHPMyAdmin, as I remember, it automatically masks them! Try the same statement on mysqls commandline. Good luck Keith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Whimper, help :)
-Original Message- From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]] Sent: 04 December 2002 06:28 http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bre ady+maria%26quot%3B http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bre ady+maria%26quot%3B I blame PHP. Can't be MySQL. echo $sql displays the EXACT same thing. Debugging ... Works jdaxell.ccl = 2 records found: $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\'ready maria\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.test.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM .$table. WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.table.inc.phps As far as I can see, *none* of these produce an identical query string to your hard-coded version -- they *all* have the double-quotes around the search string missing! Try this: $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; (BTW, I'm not sure you need the stripslashes() -- I don't use MySQL, so I can't be sure, but doesn't it need quotes to be backslash-escaped inside a quoted string?) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whimper, help :)
[snip] As far as I can see, *none* of these produce an identical query string to your hard-coded version -- they *all* have the double-quotes around the search string missing! The double quotes are in $search, that's why. And the stripslashes is there more than likely because of magic_quotes_gpc, which will make $search equal to \ready maria\ What if you do it this way? $search = 'ready maria'; $sql = SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.$search.' IN BOOLEAN MODE) ORDER BY id asc; Does that work? Are you sure the quotes you enter in the box aren't being converted to quot; or %XX or something, and then causing your query to fail or return odd results? ---John Holmes... Try this: $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; (BTW, I'm not sure you need the stripslashes() -- I don't use MySQL, so I can't be sure, but doesn't it need quotes to be backslash-escaped inside a quoted string?) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whimper, help :)
Hi, Wednesday, December 4, 2002, 2:06:36 PM, you wrote: JTJ Martin, JTJ Anyone, JTJ I'm desperate :( PHP isn't sending my SQL correctly. It's not a MySQL problem. It's my PHP syntax. JTJ Debugging: JTJ http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26quot%3B JTJ $sql = 'SELECT ... FROM '.$table.' WHERE MATCH ... AGAINST JTJ (\'ready maria\' IN BOOLEAN MODE) ORDER BY id asc'; JTJ Yay ... :) it works!!! (http://ccl.flsh.usherb.ca/print/display.test.inc.phps) JTJ If I copy paste this SQL into PHPMyAdmin, it works. JTJ BUT IT WON'T WORK IN PHP. The code belows echos $sql correctly, but MySQL thinks it received: JTJ +ready +maria JTJ not JTJ ready maria JTJ See: http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B JTJ $sql = 'SELECT ... FROM '.$table.' WHERE MATCH ... AGAINST JTJ (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id JTJ asc'; JTJ $sql = SELECT ... FROM `$table` WHERE MATCH ... AGAINST JTJ ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id JTJ asc; JTJ See (http://ccl.flsh.usherb.ca/print/display.table.inc.phps) JTJ What is the correct PHP syntax to get MySQl to read my SQl correctly? JTJ What am I f***ing up? JTJ John If you are looking for in a string just quote it with ' example $like = 'ready maria'; $ sql = SELECT .. WHERE LIKE '$like'; no need to escape anything -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whimper, help :)
Tom, Anyone, No I'm not looking for a , I'm trying to pass double quotes into MySQL. Like I said, it works when debugging: http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26quot%3B http://ccl.flsh.usherb.ca/print/display.test.inc.phps but fails when I try to pass my double quotes in: http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B http://ccl.flsh.usherb.ca/print/display.table.inc.phps $sql = SELECT id,AU,ST,BT,AT FROM `$table` WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; I already have the input type=text name=search $search I have tried many variations. If you are looking for in a string just quote it with ' example $like = 'ready maria'; $ sql = SELECT .. WHERE LIKE '$like'; no need to escape anything -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Whimper, help :)
what are the field types in the mysql DB? -Original Message- From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 4 December 2002 4:13 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Whimper, help :) Tom, Anyone, No I'm not looking for a , I'm trying to pass double quotes into MySQL. Like I said, it works when debugging: http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+ maria%26quot%3B http://ccl.flsh.usherb.ca/print/display.test.inc.phps but fails when I try to pass my double quotes in: http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+ maria%26quot%3B http://ccl.flsh.usherb.ca/print/display.table.inc.phps $sql = SELECT id,AU,ST,BT,AT FROM `$table` WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; I already have the input type=text name=search $search I have tried many variations. If you are looking for in a string just quote it with ' example $like = 'ready maria'; $ sql = SELECT .. WHERE LIKE '$like'; no need to escape anything -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whimper, help :)
Peter Houchin wrote: Mostly varchar(255) and a couple of text. (I may have one longtext). But should that make a difference? Like I said, I can run the same SQL in PHPMyAdmin (a MySQL interface) and I get the correct reponse. But pass it through PHP and kablooey. Won't work? John what are the field types in the mysql DB? -Original Message- From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 4 December 2002 4:13 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Whimper, help :) Tom, Anyone, No I'm not looking for a , I'm trying to pass double quotes into MySQL. Like I said, it works when debugging: http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+ maria%26quot%3B http://ccl.flsh.usherb.ca/print/display.test.inc.phps but fails when I try to pass my double quotes in: http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+ maria%26quot%3B http://ccl.flsh.usherb.ca/print/display.table.inc.phps $sql = SELECT id,AU,ST,BT,AT FROM `$table` WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; I already have the input type=text name=search $search I have tried many variations. If you are looking for in a string just quote it with ' example $like = 'ready maria'; $ sql = SELECT .. WHERE LIKE '$like'; no need to escape anything -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- John Taylor-Johnston - If it's not open-source, it's Murphy's Law. ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke: http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whimper, help :)
http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26quot%3B http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B I blame PHP. Can't be MySQL. echo $sql displays the EXACT same thing. Debugging ... Works jdaxell.ccl = 2 records found: $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\'ready maria\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.test.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM .$table. WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.table.inc.phps :0 John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whimper, help :)
http://ccl.flsh.usherb.ca/print/print.html?search=%26quot%3Bready+maria%26quot%3B http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B I blame PHP. Can't be MySQL. echo $sql displays the EXACT same thing. Debugging ... Works jdaxell.ccl = 2 records found: $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\'ready maria\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.test.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM $table WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = SELECT id,AU,ST,BT,AT FROM .$table. WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST ('.stripslashes($search).' IN BOOLEAN MODE) ORDER BY id asc; http://ccl.flsh.usherb.ca/print/display.table.inc.phps Doesn't work - Resembles +ready +maria $sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST (\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc'; http://ccl.flsh.usherb.ca/print/display.table.inc.phps :0 John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php