$sql = 'INSERT INTO fs_usermetadata (' . substr(trim($cols), 0,
strrpos(trim($cols), ',')) .
') VALUES (' . substr(trim($values), 0, strrpos(trim($values),
',')) . ')';
if (!mysql_query($sql)) {
$hasSubmittedUser = 0;
$errorMsg .= $font . '<font color=cc0000><li>Could not insert record
into db</li></font>' .
'</font><p>';
}
if ($hasSubmittedUser) {
// THIS BLOCK WILL ENSURE THAT THE ID WILL BE PASSED AND ALL DATA
GATHERED FOR EDITING
// OF RECENTLY SUBMITTED INFORMATION
$willEditUser = 1;
$sql = 'SELECT fs_userid FROM fs_usermetadata ' .
'WHERE fs_username = \'' . $fs_username . '\' ' .
' AND fs_password = \'' . $fs_password . '\' ';
$query = mysql_query($sql) or die('Could not run updated data select
query: ' . $sql);
while ($row = mysql_fetch_array($query, MYSQL_ASSOC)) $id =
$row["fs_userid"];
}
On occasions the "select" query will die for no apparent reason. The
"insert statement" is nullified and not done either. However, upon the user
hitting the back browser button and resubmitting both work fine and then
continue to work fine for an indeterminate amount of time.
Perhaps I'm missing something here: what I'm trying to do is insert a new
record and immediately obtain the id column field value from the new record.
Thanks
Phil