Jump to content


Photo

UPDATING record in mySQL. PLEASE HELP


  • Please log in to reply
23 replies to this topic

#21 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 21 August 2006 - 01:39 PM

I assume the problem relates to update.php not updating records?

Update.php appears to expect to get the information to be updated from a POST array ... but I don't see any POSTed form action anywhere in the code.  I do see a link equivalent to update.php?id=something (which isn't going to place any information in a POSTed array).  All edit.php does is display the information.

Perhaps it would be helpful to post the current version of update.php and the current version of 'whatever it is' that is linked to update.php so we can focus on complete scripts rather than attempt to follow the various script changes suggested piecemeal in the thread.
Legend has it that reading the manual never killed anyone.
My site

#22 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 21 August 2006 - 05:18 PM

hmm. I suspect the update query is doing nothing because the value of id does not exist for the UPDATE query.

Add an extra line to the form in update.php so that the record ID gets POSTed:

<input type="hidden" name="id" value="<?php echo $id;?>"/>

Legend has it that reading the manual never killed anyone.
My site

#23 pezzie

pezzie
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 21 August 2006 - 05:33 PM

You are god. Thank you very much.

i dnt know how to thank you mate.

thank you

#24 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 21 August 2006 - 06:09 PM

The not-so-secret secret methods of debugging queries that "refuse to work" is to know exactly what the query is - which is frequently not what you think it is - and what the specific error is.

$query = " .... whatever the query is ...";
echo $query; // nice to know what's happening

Also, learn to make better use of error trapping with code like this:

$query = " .... whatever the query is ...";
$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);

Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users