Updating a database

wxdqz

New Member
Hi.
I have a mysql database and i am trying to update a field in the table called \"albums\".
The albums table has a field called alb_hits which should keep track of the number of times the album has been accessed.
This is the code i am trying to update the # of hits with. $myrow is an array with the album information. I take the current hits from the array and store them in $hits. Add one to the $hit variable and then try to update the database. The $hits is always one more then the current number but the database is not updated.

What am i doing wrong? Is the syntax ok?

$hits=$myrow[\"alb_hitet\"];
$hits++;
$sql = \"UPDATE albums SET alb_hits=\'$hits\' WHERE alb_id=$id\";
 
Back
Top