Page 1 of 1

mysql query problem

Posted: Wed Oct 03, 2007 2:22 am
by thewebdrivers
Hello all

I am having some trouble in debugging a problem. My query returns results in mysql query browser and phpmyadmin but not when it is called from php page. It does not happen all the time but only under some conditions.

For example - select * from table where 'formz-6.1' = LCASE(strip_all_unsafe_chars(`title`)) returns result at mysql query browser but not when it is called from php page.

but

select * from table where 'usb-external-3.5-mac-hard-drive-kit'=LCASE(strip_all_unsafe_chars(`title`))
returns results both at mysql query browser and from php page.

strip_all_unsafe_chars() is a stored function that i have created in mysql.

I donot know if this is a common problem but this is the first time I have encountered such problem. Any help will be highly appreciated.

Regards

Mike

Posted: Wed Oct 03, 2007 6:51 am
by s.dot
Make use of the mysql_error() function. And also, there could be a problem with your custom functions not returning anything.

Posted: Wed Oct 03, 2007 6:55 am
by thewebdrivers
hi thanks for your reply but i figured out the problem. the problem was due to presence of special characters in field and they were not stripped properly by the stored function. i used char(code) function to find and replace them.

thanks for your help anyways.