Forum Moderators: coopster

Message Too Old, No Replies

php mySQL select fails - but works in phpMyAdmin

php mySQL select statement fails, but works in phpMyAdmin

         

san_fran

6:10 pm on Dec 10, 2003 (gmt 0)



I have a mysql problem that has me completely stuck:

If I run the following query in phpMyAdmin, I get 4 results:
SELECT * FROM b4ads WHERE instr(lower(comments),'erika')>0

But, if I insert the query into a .php file as the following line, I only get 3 results:
mysql_query("SELECT * FROM b4ads WHERE instr(lower(comments),'erika')>0",$dbq);

Even if I use the working phpMyAdmin results via the "create PHP" link, it does not work when I insert it into the php file (I still only get the 3 results):
$sql = 'SELECT * ';
$sql .= 'FROM `b4ads` ';
$sql .= 'WHERE instr( lower( comments ) , \'erika\' ) > 0 LIMIT 0, 30';
mysql_query($sql,$dbq);

IMPORTANT HINT:
If I Edit the excluded result in phpMyAdmin, and "Insert as a new row", the new (exact same) row DOES show in the php query.

ALSO:
The result that is not being found by the php query is one that was inserted into the table b4ads by importing from a text file via phpMyAdmin, if that makes any difference.

Any ideas?

jatar_k

10:16 pm on Dec 10, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld san_fran,

sounds like corrupt or strange data. Have you taken a look for a strange char or anything else that may be the cause? Since it works once you reinsert it I wonder if there may be something in there.