Insane!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Insane!

Post by spacebiscuit »

Hi guys,

This just does not make sense.

Here is my PHP code:

Code: Select all

$query_update="UPDATE $_POST[table] SET image_filename='$image_filename' WHERE id=$_POST[id]";
 
if($result=mysql_query($query_update)){
      echo"$query - Success!";
                      }
When I run this 'Success' is out put to my screen indicating that the query has been sucessful, yet when I check the MYSQL table the update has not been made. I don't understand how this could be possible - any ideas?

Thanks,

Rob.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Insane!

Post by requinix »

mysql_query only tells if the query worked - not if it actually did anything.

Use mysql_affected_rows to see if anything changed.
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Re: Insane!

Post by spacebiscuit »

Thanks that is useful to know.

I have found the problem, it was my sanity that was in question!!!

Rob.
Post Reply