I have posted the following 3 ID's to a php page via an array.
This page needs to do some sql processes:
The IDs are:
25, 26, 17
I have printed the 3 ID values with the following code:
($idString being the variable passed via an array from the previous page)
<?
foreach($idString as $idValue) {
echo "$idValue<BR>";
}
?>
The mysql query code is this:
<?
$db_name = "thepond";
$table_name = "employees";
$connection = @mysql_connect("localhost", "root", "") or
die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database.");
$sql = "SELECT *
FROM $table_name
WHERE id = \"$idValue\"
";
$result = @mysql_query($sql,$connection)or die "Couldn't execute query!");
while ($row = mysql_fetch_array($result)) {
$FirstName = $row['FirstName'];
$LastName = $row['LastName'];
$Email = $row['Email'];
$Extension = $row['Extension'];
$Branch = $row['Branch'];
$Department = $row['Department'];
$Title = $row['Title'];
$Birthday = $row['Birthday'];
$SymitarID = $row['SymitarID'];
$Account = $row['Account'];
}
$EmployeeName .= "$FirstName $idValue";
?>
when i print or echo the Employee Name, i only get the last record:
Tami 17
Please advise on how I can get all records for each ID selected out of the database. Thank you! -Jon