Anyone know how to tell the mysql database to add 100 hits to each link? Cause I really dont' want to go in and edit each link one by one. Thanks
Hart
Anyone know how to tell the mysql database to add 100 hits to each link? Cause I really dont' want to go in and edit each link one by one. Thanks
Hart
I guess it can't be done in a single command. You have to save the current hits in a variable and add it with 100. Also the records need to be fetched one by one, because the values could be different.
This code can be an alternative, but not using Indexu's style - accessing the class file
$query="SELECT * FROM idx_link";
$result=mysql_query($query);
$num_rows=mysql_num_rows($result);
for ($i=0;$i<$num_rows;$i++) {
$link_id=mysql_result($result,$i,"link_id");
$hits=mysql_result($result,$i,"hits");
$hits=$hits+100;
$query2="UPDATE idx_link SET hits=$hits WHERE link_id=$link_id";
$result2=mysql_query($query2);
}
I hope it can help.
Sofiah
Last edited by sofiah; 04-16-2002 at 09:39 AM.