I'm afraid Im not a coder and have to use a crutch (metaphorically speaking) Heres the new code using the mysql_insert_id();. No errors and it inserts into both tables, but in the child table, parent_id it just puts NULL for each row. The column is set to NULL, but surely will to force a value ie not null
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO parent (parent_id, f_name, l_name) VALUES (%s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['parent_id'], "int"),
GetSQLValueString($HTTP_POST_VARS['f_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['l_name'], "text"));
$parent_id = mysql_insert_id();
mysql_select_db($database_test_conn, $test_conn);
$Result = mysql_query($insertSQL, $test_conn) or die(mysql_error());
if(isset($parent_id));
$insertSQL = sprintf("INSERT INTO child (child_id, parent_id, road, city) VALUES (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['child_id'], "int"),
GetSQLValueString($HTTP_POST_VARS['parent_id'], "int"),
GetSQLValueString($HTTP_POST_VARS['road'], "text"),
GetSQLValueString($HTTP_POST_VARS['city'], "text"));
mysql_select_db($database_test_conn, $test_conn);
$Result = mysql_query($insertSQL, $test_conn) or die(mysql_error());