I treid my own code and it goes like this:
$sql2 = "SELECT 'id' FROM tc_pat";
$result2 = mysql_query($sql2) or die ("Sorry the login for $user is invlaid, please try again, or contact the network administrator for furthur assistance. ERROR#787");
$lastrow = mysql_num_rows($result2);
$lastid = $result2[$lastrow];
$nextid = $lastid + 1;
but it doest work! What do I do 😕