celestine
11-11-2003, 02:48 AM
I've been trying to write a counter to count the number of times a link is click. Unfortunately, PHP is acting really weird for me.
Currently running PHP 4.3.3
include_once('xxx/yyy.php'); // my function, mysql connection file
$qAvatar = "select * from templates where tid='$tid' ";
$rsAvatar = db_query($qAvatar);
while ($row = mysql_fetch_array($rsAvatar))
{
extract($row);
$downfile ="$pspfile";
$pspdowncount+=1;
$up = "update templates set pspdowncount='$pspdowncount' ";
$up .= " where tid='$tid' ";
$rsUp = db_query($up);
if ($rsUp)
{
echo "$up";
echo "<p class=header2>Download Templates</p>";
echo "<p align=center><a href=$downfile>Download $mode version here</a></p>";
}
}
What happens is that it increment sometimes by 1, sometimes by 2. Seems to be random but mostly increment by 2. Is this a PHP bug or that I have calculated wrongly ? Thanks
Currently running PHP 4.3.3
include_once('xxx/yyy.php'); // my function, mysql connection file
$qAvatar = "select * from templates where tid='$tid' ";
$rsAvatar = db_query($qAvatar);
while ($row = mysql_fetch_array($rsAvatar))
{
extract($row);
$downfile ="$pspfile";
$pspdowncount+=1;
$up = "update templates set pspdowncount='$pspdowncount' ";
$up .= " where tid='$tid' ";
$rsUp = db_query($up);
if ($rsUp)
{
echo "$up";
echo "<p class=header2>Download Templates</p>";
echo "<p align=center><a href=$downfile>Download $mode version here</a></p>";
}
}
What happens is that it increment sometimes by 1, sometimes by 2. Seems to be random but mostly increment by 2. Is this a PHP bug or that I have calculated wrongly ? Thanks