Helpful Information
 
 
Category: Databases
Beginner: bug in linkcounter (using mysql and php)

I use the following small programm as a linkcounter:
It works, but there is a bug in it I cannot kill:

<?php
mysql_connect("localhost");
$identid =mysql_db_query("test","select votes from counting WHERE (name='Jana')");

while($line = mysql_fetch_row($anweisungsid)) {
$votes = $line[0] + 1;
}
mysql_query("update counting SET votes='$votes' WHERE (name = 'Jana')");

echo "<TABLE><TR><TD WIDTH=70% VALIGN='top'><H3>Jana:</H3></TD><TD VALIGN='top' WIDTH=30%><SPAN STYLE=color:red><H3>$votes</H3></SPAN></TD></TR></TABLE>";
include("link.html")
?>

When you start it works fine.
Click on the girl number 1 and her votes will be increased.
Click next on the girl numer 2 and her votes will be increased.
Click next on the girl number 3 and her votes will be increased.

BUT NOW:
If you click on whatever girl her votes will NOT be increased.
Only if you click again on the same girl her votes will be increased. If you click once again on her it will increase her votes again.
So what is it?

Any help would be very much appreciated.
You can find the website on www.hookers.de. (http://www.hookers.de.) (Link on the left side: PHP-SQL)
The direct link is www.hookers.de/phpsites/php_frame.html (http://www.hookers.de/phpsites/php_frame.html)

Hi Toxicbuddha,

The only thing I can see is that you must not mix up english and german ids:

>>$identid =mysql_db_query

>>while($line = mysql_fetch_row($anweisungsid))

PHP only understands PHP and did not learn any other languages! http://www.devshed.com/Talk/Forums/smile.gif

Happy coding,

Peter

[QUOTE]Originally posted by PAV:
[B]Hi Toxicbuddha,

The only thing I can see is that you must not mix up english and german ids:

>>$identid =mysql_db_query

>>while($line = mysql_fetch_row($anweisungsid))

hi peter,
the original code is not mixed up, I wanted to "translate" the code for english readers when I posted it, otherwise it would have not work at all, I suppose http://www.devshed.com/Talk/Forums/wink.gif).
but thanxs for your hint nevertheless.

I have seen in the meantime that with simple html-coding <meta http-equiv="expires" content="0"> the script works fine on windows98 with apache - but not on the unix server.

toxicbuddha










privacy (GDPR)