Php-Mysql, select and update trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Phpers,

I have the following part of a script that retrieve an URL site. I'd like
to count the clicks for every URL. I have added to mysql table a column
"hit". May anybody tell me how to insert into an sql selection also an
update, referring to the HIT variable (i.e. to realize a select and update
together) ?

This is the select I'm using:

<? 
require("../connection.php"); 
$link = mysql_connect($host,$user,$password);
$result=mysql_db_query($base,"select url from ".$baseofsites." where
id=".$s." ",$link);
$url = mysql_result($result,0,"url");
header("Location: ".$url."");
exit();  
?>

This should be (I suppose) the sql update I must include ... UPDATE
table.sites SET hit = hit + 1 WHERE id=$s 

Thanks for all, Alessandro

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux