misslois74
Programmer
im trying to insert into a primary key field which is an alphanumeric which is combination of 'S00' and an incrementing value like for instance: S001, S002, S003 i want it to be system generated...
i have the ff. codes:
$sname = $_POST["supplier_name"];
$saddr = $_POST["supplier_address"];
$scontact = $_POST["supplier_contact"];
$quer = "Select max(substr(supplier_id,-1,1))+1 from supplier";
$row = mysql_query($quer);
$res = "Insert into supplier values(concat('S00',$row),'$sname','$saddr','$scontact')"
mysql_query($res);
what could be the problem with my codes, when i tried the select statement in the MYSQL console its working very fine but once i place it in php and execute it its not adding to the table...
hope anybody could help me with these.
thanks....
i have the ff. codes:
$sname = $_POST["supplier_name"];
$saddr = $_POST["supplier_address"];
$scontact = $_POST["supplier_contact"];
$quer = "Select max(substr(supplier_id,-1,1))+1 from supplier";
$row = mysql_query($quer);
$res = "Insert into supplier values(concat('S00',$row),'$sname','$saddr','$scontact')"
mysql_query($res);
what could be the problem with my codes, when i tried the select statement in the MYSQL console its working very fine but once i place it in php and execute it its not adding to the table...
hope anybody could help me with these.
thanks....