Forum Webscript.Ru
Общие => Базы данных => Тема начата: Admin q3 от 19 Марта 2002, 15:55:39
-
Как сделать так, если в таблице есть такие-то данные то сделать то-то если нет то другое пробывал так
$bresult3 = mysql_query("select day from histor where (day=\'$data\') and (hid=\'$cid\') ");
list($ciddate) = mysql_fetch_row($bresult3);
$bresult4 = mysql_query("select day from histor where (day=\'$data\') and (hid=\'$bid\') ");
list($biddate) = mysql_fetch_row($bresult4);
if ($ciddate=""):
mysql_query("insert into histor values (NULL,\'$data\',\'$cid\',\'0\',\'0\',\'0\',\'0\') ");
endif;
mysql_query("update histor set hsviews=hsviews+1 where (hid=$cid) and (day=\'$data\') ");
if ($biddate =""):
mysql_query("insert into histor values (NULL,\'$data\',\'$bid\',\'0\',\'0\',\'0\',\'0\')");
endif;
mysql_query("update histor set hviews=hviews+1 where (hid=$bid) and (day=\'$data\') ");
-
mysql_num_rows (http://ru.php.net/manual/ru/function.mysql-num-rows.php)