<?php
session_start(); //ignore this
include 'db.php'; //connect to db
$id = 2;
$sql = mysql_query("SELECT * FROM fking_grad WHERE id='$id'"); //try and select an id
$id = mysql_num_rows($sql); //turn the data into info
if ($id > 0) { // if the person has an id (has to be bigger than 0)
mysql_query("UPDATE fking_grad SET id=(id + 1) WHERE id='$id'");
} else {
$sql = mysql_query("INSERT INTO fking_grad (monday, tuesday, wednesday, thursday, friday)
VALUES(0, 0, 0, 0, 0, 0, 0") or die (mysql_error());
}
?>
whats wrong here guys?
You have an error in your SQL syntax near '' at line 2