...

View Full Version : Debug PHP/MySQL Probable Simple Mistake...



As5a5sIn5
06-03-2004, 07:14 AM
can someone tell me what's wrong with this script...i copied it rite off phpfreaks.com and it don't work...i'm sure it's because my table has different names...but here take a look

<?php
$link = mysql_connect("localhost", "???", "???")
mysql_select_db("AnthonySQL")
mysql_query("UPDATE webhits SET index=(count + 1)");
mysql_close($link);
?>

The table is named webhits
and we're trying to make 'index' increase by 1
...anyone c the problem? I think error says its this line

mysql_query("UPDATE webhits SET index=(count + 1)");

Not positive tho..

firepages
06-03-2004, 08:14 AM
a quick guess wuld be ...

mysql_query("UPDATE webhits SET index=(index + 1)");

As5a5sIn5
06-03-2004, 09:38 PM
Okay Thanks I hAve no Errors now...but now the script itself doesn't work...any suggestions? :confused:

firepages
06-04-2004, 03:50 AM
is 'index' an integer type field ? (if not make it so) , also do you have several records & a primary key , e.g. do you need to add a WHERE id=$id to your query ?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum