I have two MySQL tables: Location and Contact. Each have a numeric primary key LocationID and Contact ID. The SQL statement for retrieving record information is identical for each, so instead of repeating my SQL, I set up a quick array.
$detail = array("Location","Contact");
Now I want to set up my query:
foreach ($detail as $key => $value) {
$query = "SELECT * FROM ".$value." WHERE ".$value."ID = $[$value]ID";
}
The values of $LocationID and $ContactID come from session variables.
What's wrong with the syntax at "=$[$value]ID"??
Thanks, Ruth