function getNewID($fieldName, $tableName) { // INT "METHOD" FOR
NON-AUTO-INCREMENT FIELDS
global $dbConn;
$sql = "SELECT MAX($fieldName) FROM $tableName";
$query = mysql_query($sql, $dbConn) or die('Could not perform query: ' .
mysql_error());
if (!($row = mysql_fetch_row($query))) return 1;
return $row[0];
}
I'm trying to retrieve the max(ID) from a column that cannot be
auto_incremented (since mySQL version on this remote site only allows for
tables to have ONE auto_increment field - how stupid), the basic premise is
this:
I either return
1) the max ID
2) '1'
How have you guys done it, or what have I missed?
Phil