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

06-03-2004, 08: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

$link = mysql_connect("localhost", "???", "???")
mysql_query("UPDATE webhits SET index=(count + 1)");

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..

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

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

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

06-04-2004, 04: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 ?