sorry fixed it problem with sql query
Hi im trying to create a script to calculate the higest number in a result add add one to the total and insert this into the database the script doing the querying and calculation but not inserting into the database.
Any ideas
Cheers
$hostname = "localhost";
$username = "user";
$password = "pass";
$dbname= "COMPS";
mysql_connect($hostname, $username, $password);
mysql_select_db($dbname) or die( "cant connect to $dbname");
$Code = "0000001";
$result = mysql_query ("Select MAX(Id) from BOARD WHERE BOARD.Code = $Code");
$lastcount = mysql_result( $result, 0 );
print $lastcount;
$count = $lastcount + 1;
mysql_query ("INSERT INTO BOARD (Id, Code) VALUES ('$count', '$Code')");
print $count;
print $Code;:eek: :eek: :p