A Hidden Counter
Hey guys, i'm trying to write a hidden counter...basically, whenever someone visits the page, it opens a MySQL table, finds a field, and adds one, and then closes. Still not so good at PHP, so i need some help. This is what i have:
<?php
$dbh = mysql_connect(\"localhost\",\"...\",\"...\");
mysql_select_db(\"data\");
$numberadd = mysql_field_seek(\"number\");
mysql_query(\"INSERT ++number INTO number\");
mysql_close(\"$dbh\");
?>
i would test this, but my domain registration/hosting creation is in progress, so i can't. is this anywhere near correct? thanks for helping
necrotic posted this at 16:13 — 8th July 2003.
He has: 296 posts
Joined: May 2002
<?php
$con = @mysql_connect(\"localhost\",\"...\",\"...\");
if (!@mysql_select_db(\"data\",$con)) die (\"Could not connect to database at this time\");
if (!@mysql_query(\"UPDATE table_name SET field=field+1\")) die (\"Error running mysql_query. MySQL Error:\".mysql_error());
mysql_close($con);
?>
Good luck with your site
[James Logsdon]
kb posted this at 17:45 — 8th July 2003.
He has: 1,380 posts
Joined: Feb 2002
wow...i was sort of close...not!
lol thanks man
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.