PHP lying to me about results

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: PHP lying to me about results

Post by Benjamin »

So this is what we know:

1. The query is valid and does not have any syntax errors.
2. The query works when tested from CLI
3. The query is being sent to the MySQL server
4. No errors are being returned
5. If the query is broken intentionally, an error IS being returned.

So let's assume that the query is working, but the updated record is not being reflected in the database. How could that happen? Have you checked mysql_affected_rows by chance? Not sure if you mentioned that already now that I am typing this out.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: PHP lying to me about results

Post by VladSun »

pytrin wrote:... maybe Vlad has an idea
Nope :(

But I would consider this PHP side problem, not DB side... It looks like this...
You may try creating a clean file, write (no copy-pasting) the function and use this file instead.

PS: You don't have a call to stored procedure before this query, do you?
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: PHP lying to me about results

Post by pickle »

Nope - no stored procedures period.

I'll try re-writing the function - see if that fixes anything.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: PHP lying to me about results

Post by Benjamin »

Not that I see this being a problem, but try changing the code for the query to this:

Code: Select all

 
$query = "UPDATE
                   `response`
                 SET
                   `number` = '$number'
                 WHERE
                   `response_id` = '{$this->response_id}'";
 
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: PHP lying to me about results

Post by Benjamin »

Did you ever figure out what the problem was pickle?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: PHP lying to me about results

Post by pickle »

No. I was going to finish off this thread today, but you responded before I got a chance ;)

I have a limited number of hours paid for to work on this project & this little bug has taken 5 hours so far. The client has decided to remove the feature that was surrounding this bug, and move on to other things.

Bugs the hell out of me that I have absolutely no clue... but it's not my money.

Thanks for all the help everyone - it's at least a little re-assuring that the greatest minds the Internet has to offer is are just as stumped as I.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: PHP lying to me about results

Post by VladSun »

pickle wrote:Thanks for all the help everyone - it's at least a little re-assuring that the greatest minds the Internet has to offer is are just as stumped as I.
:lol: :lol: :lol:
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply