Hi I cant get this code to add the next number to imp when I run this script.
$result1 = mysql_query("UPDATE queerhuntradio_video_ads SET imp='+1' WHERE id='$row[id]' AND imp='$row[imp]'");
So if imp is 1 it makes it 2 if 2 it makes it 3
Please help
Hi I cant get this code to add the next number to imp when I run this script.
$result1 = mysql_query("UPDATE queerhuntradio_video_ads SET imp='+1' WHERE id='$row[id]' AND imp='$row[imp]'");
So if imp is 1 it makes it 2 if 2 it makes it 3
Please help
The web in one word.
Got it to work
The web in one word.
if you want to increase imp +1 you have to get the old value at first to add 1 on it like :
Try it and let me know the result .PHP Code:
<?php
$sql = "select * from queerhuntradio_video_ads where id='$row[id]' ";
$res = @mysql_query ($sql);
$result = @mysql_fetch_array($res);
$old_value = $result[imp];
$new_value = $old_value +1 ;
$result1 = mysql_query("UPDATE queerhuntradio_video_ads SET imp='$new_value' WHERE id='$row[id]' AND imp='$row[imp]'");
I believe it is possible in SQL to set something like tmp=tmp + 1
So:
Here's a link to clear up things up.PHP Code:update table where table.id = 1 SET value = value + 1
Bookmarks