Closed Thread Icon

Topic awaiting preservation: php mysql problem (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=28263" title="Pages that link to Topic awaiting preservation: php mysql problem (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: php mysql problem <span class="small">(Page 1 of 1)</span>\

 
EDDII
Bipolar (III) Inmate

From:
Insane since: May 2004

posted posted 07-27-2006 23:55
code:
<?php
header("Content-type: image/png");
$datab=mysql_connect("localhost", "db", "pass");
mysql_select_db("bloodonthecanvas_com_1");
$id=trim($id);
$ip = GetHostByName($REMOTE_ADDR); 
MYSQL_QUERY("INSERT INTO `farrierhits` (`ip`) VALUES ('$ip')");
$vis=mysql_QUERY("SELECT COUNT(DISTINCT(`ip`)) FROM `farrierhits`");
$widthcalc=strlen($vis);
$px    = 7.5 * $widthcalc;
$im    = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 255, 0, 0 );
$font = imageloadfont("timesbd.ttf");
imagestring($im, $font+5, 0, 0, $vis, $orange);

imagepng($im);
mysql_close($datab);
imagedestroy($im);

?>


ok this is an image i have which is suposed to be a hit couter but at the moment it is logging each hit twice and i cant figure out why
can anyone help?
p.s. it might be a little messy as i have been messing around with it trying to figure out the problem

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 07-28-2006 02:40

2 things.

What do you mean by "loggin each twice"? There's no loop apperent in the code so I'm assuming you don't mean being logged twice in the db.

What is this supposed to be doing

code:
$widthcalc=strlen($vis);


If I'm reading this right $vis is holding a mysql result set so I'm not sure what you're getting by doing strlen on it.

- Butcher -

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-28-2006 05:34

you're sure the image isn't on teh page twice?



.:[ Never resist a perfect moment ]:.

EDDII
Bipolar (III) Inmate

From:
Insane since: May 2004

posted posted 07-28-2006 18:28

sorry, i was quite tired when i posted this
im not quite sure about why thats there
and yes it does log each entry in the database twice

« BackwardsOnwards »

Show Forum Drop Down Menu