Jump to content

Recommended Posts

Hi all,

 

I am having some trouble getting a query to run and I was hoping someone might be able to point out why.

 

 

Here is the SQL:

 

UPDATE `myTable` SET `myColumn`='SomeText' WHERE ID='15'

 

thanks

 

 

Every time I run it, it just returns as 0 rows affected.. and surely enough checking the DB shows that nothing has happened.

Link to comment
https://forums.phpfreaks.com/topic/265141-help-with-a-query/
Share on other sites

OK so I did a test, I copied this generated SQL and pasted it into PHP my ADMIN and it works just fine... so there is nothing wrong with the SQL why does it not execute?

 

I have a DB access object that i wrote.. It probably fires off 20 or 30 some queries through this exact same method yet for some reason this ONE query doesn't run.. I just don't get.

None of the column names are wrong.. none of the values are already in the DB, mysql_error reports no errors and affected rows says 0.

 

I double checked and checked and rechecked and checked again to see if there was some issue stopping the query from being run or something along those lines and no such thing.

The SQL statement gets sent to the DB and the DB puts up its middle finger.

Link to comment
https://forums.phpfreaks.com/topic/265141-help-with-a-query/#findComment-1358998
Share on other sites

the only way to get some help is if you post the relevant code where you are using that line, otherwise is only a guessing game

 

I would love to do this for you mikosiko but like I said it is wrapped up within an entire database object, even if I showed you the code where the SQL is compiled for the query you wouldn't have any clue what was going on.

I would have to basically show you two full objects and a bunch of other crap...

 

However your bit about error reporting got me thinking ... Why not check the error log just in case the error didn't get output to the error catch.

 

I figured out the problem... I was missing a ">" character when I was calling the link method to the DB.

How fricken stupid is that.. honestly it should have thrown up a syntax error but it didn't.

mysql_error didn't even report that the connection wasn't being established... SOAFB.

 

Thanks for the help... (such a stupid issue lol)

 

Link to comment
https://forums.phpfreaks.com/topic/265141-help-with-a-query/#findComment-1359006
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.