Forum Moderators: open

Message Too Old, No Replies

MYSQL query works in database but not on page

         

meingalls

5:39 am on Aug 21, 2006 (gmt 0)

10+ Year Member



I have a website built in PHP/MySQL. On one page, I run a query that generates an error. So I printed out the query prior to executing it. I then copied the SQL statement and ran it in PHPMyAdmin. It runs fine when I run it directly against the database, but it errors out when I run it within a web page.

Has anyone else ever seen this behavior?

Any suggestions?

Thanks

Mel

rocknbil

7:22 am on Aug 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes. :-)

Post the query here so we can see it, and feel free to change the table name.

Look for quoting errors maybe? The phpAdmin is probably correcting them for you. You aren't testing it directly unless you've installed mysql locally and run it from the command line (which you should do.) For example,

select id from customers where lname='O'Malley'; #oops

select id from customers where lname='O''Malley'; #works

select id from customers where lname="O'Malley"; #ditto