I want to do something really easy, but after 4 hours of hacking away at it I don't seem to be able to find the answer.
Every time someone uses a simple PHP took I have, they click submit, I just want this to add one to a table, for example my table is called score_calc_useage, and has one field, a largeint called useage. So upon clicking submit, 1 should be added, I can't get it though.
Below is what I've got, I've tried setting a $useage variable of $useage + 1 and similar, but I can't read the current number from the database, if I can get that out somehow, into a variable with I can then just add one to and insert back I'd be sorted!
<?php
include "connect.inc";
$result = mysql_query("SELECT * FROM score_calc_useage",$db);
do {
printf ("%s\n", $myrow["useage"]);
} while ($myrow = mysql_fetch_array($result));
if ($submit) {
$sql = "UPDATE score_calc_useage SET useage='$useage + 1'";
$result = mysql_query($sql);
mysql_close();
}
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<INPUT TYPE=SUBMIT NAME="submit" VALUE="SUBMIT">
</FORM>
Thanks for any help.