Hi i need to count the number items in an album now on the album i have create a field called count which counts the number items in that album
but now i dnt knw how to update those as soon insert a item in the table item
so i thought woul be possible to create a script that when insert data into item tables also update album table row count by adding one like update count with A now A equal row count ++1 minus if delete any help on start of it if possible???/
i tried like this but did not work any sugestions are welcome
$sql = "INSERT INTO " .PHOTOS_TABLE. "
(
photo_name,
photo_date,
photo_proper,
photo_size,
album_id
)
VALUES
(
'" .addslashes($photo_name). "',
" .time(). ",
'" .addslashes($key_name). "',
" .intval($size). ",
" .$album. "
)";
$update_query="UPDATE albums set count=count+'1' where condition"; // total will be updated to total+number of new puppies added.
mysql_query($update_query);