Firstly view source on your form script and check all the hidden values are there in the form!
Then I would change your updating query so that it is a variable, echo it and then do the mysql_query. The you can look to see what is happenning!
Code: Select all
$query="UPDATE rec_song SET name='$songname', artist='$songartist', www='$songwww' where id='$songid'";
echo "$query <p>"; //during development
$sql= mysql_query($query) or die (mysql_error());
Then use myql_affected_row() etc.
Note if you are printing out what you have in the database your browser will often use a cached version of the page, with the old results!!! <Shift><Refresh> to force a new page. and use
Code: Select all
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
in the headers, but IE is buggy on that (no surprise), so Microsoft recommend
Code: Select all
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
after the </body>
The next post will be someone saying that is not standards compliant! But its what Microsoft recommend to not cache a page!!!!!!!
Then when you have it working, I would recode it into one file for neatness!
Code: Select all
if (isset($_POST['submitted']){ // form submitted, so do the updating
//blah blah
exit();
}
//not submitted so do the update form with a hidden field called submitted