I wrote this code. Its seposed to update the click in the DB every time the page with this code is accessed. If the shop_id and todays date dont exist then create a new one...
$date = date("Y-m-d");
$result = mysql_query("SELECT * FROM pc_clicks WHERE shop_id='$shopid' AND click_date='$date'");
if(!$result){
$inResult = mysql_query("INSERT INTO pc_clicks (shop_id, click_date, click_clicked) VALUES ('$shopid', '$date', '0')");
}
$row = mysql_fetch_array($result);
$counted_clicks = $row['click_clicked'];
$counted_clicks++;
$result = mysql_query("UPDATE pc_clicks SET click_clicked='$counted_clicks' WHERE shop_id='$shopid' AND click_date='$date'");
//header("Location: $page");
Please help me find the problem.
Thx!