Thus my problem.
What I have is a table with values that I may want to import into another table. I have to check if these values already exist. tc_teams may have teams I want to display that do not exist in eto_units. if they don't exist I want them to display so I may import them with the selection of a checkbox. Then import team_id into unit_id and team_name into unit_name into my eto_units table. I'll have to figure out some sort of array for my checkboxes.
Right now my php table displays nothing. I have about 20 teams in tc_teams and about 6 or 7 that match in eto_units. So it should show just those in tc_teams that don't exist in eto_units, or at least maybe I should show the record but the checkbox is checked verifing it exist in eto_units. I could then check those others I want to import.
$sql = $db->sql_query("SELECT * FROM " . $prefix . "_tc_teams WHERE team_id NOT IN (SELECT unit_id FROM " . $prefix . "_eto_units)");
while ( $row = $db->sql_fetchrow($sql) ) {
$team_id = $row['team_id'];
$team_name= stripslashes($row['name']);
echo"<tr>"
. "<td align=\"center\" bgcolor=\"#999999\"><font color=\"#000000\">$team_id</font></td>"
. "<td align=\"center\" bgcolor=\"#999999\"><font color=\"#000000\">$team_name</font></td>"
. "<td align=\"center\" bgcolor=\"#666666\"><input type=\"checkbox\" name=\"import[]\" value=\"$team_id\">Import Team? </td>"
. "</tr>";
}
I have to perform my subquery first and loop through it with my primary query but am unsure how to structure this. Either that or use an array but again am unsure how to proceed.
Thanks in advance...you guys are great.