I have a database with many tables designed.
When I add information to table LEAUGES I want to
later populate the league_id (it's auto_incremented) to later tables.
So, after I do the INSERT INTO, what is a good way to
obtain the league_id, do I need to query LEAGUE table...?????
$query = "SELECT league_name FROM leagues WHERE league_name='$ln'";
$result = @mysql_query ($query) or die (showerror());
$chkLeagName = mysql_num_rows($result);
if ($chkLeagName == 0) {
$query = "INSERT INTO leagues (league_id, league_name,
lstreet1, lstreet2, lcity, lstateprov, lzipostal, lcountry,
lphone, lfax, lwebsite)
VALUES (NULL, '$ln', '$ls1', '$ls2', '$lc', '$lsp', '$lzp', '$lco',
'$lph', '$lfax', '$lw')";
$result = @mysql_query ($query) or die (showerror());
if ($result) {
echo '<h3>Your league has been registered!</h3>';