hello all, I am looking for some help doing multiple queries.
I have two tables that are not related that I need to query on on PHP page.
The page is for people to register for an event.
The first table has a selection of dates for people to arrive and depart from an event (for registration purposes). The second table is a table containing the users information(name, address, etc) that they registered with.
On the page, I would like to have their information already populated, to verify, and then the form for registering, and drop boxes to display the registration dates.
The query on the table for the event dates is below
$result = mysql_query("SELECT DATE_FORMAT(firstarrival, '%d %M %Y') as newfirsta, DATE_FORMAT(secondarrival, '%d %M %Y') as newseconda, DATE_FORMAT(firstdepart, '%d %M %Y') as newfirstd, DATE_FORMAT(seconddepart, '%d %M %Y') as newsecondd FROM events WHERE eventID = ".$eventid."");
if (!$result){
exit('<p>Could not retrieve the data because: <b>'. mysql_error() . "</b>. The query was $event.</p>");
}
$traveldates = array();
while ($row = mysql_fetch_assoc($result)) {
$traveldates[] = array (
"newfirsta" => $row["newfirsta"],
"newseconda" => $row["newseconda"],
"newfirstd" => $row["newfirstd"],
"newsecondd" => $row["newsecondd"]
);
}
and that works fine. if I try to call the variable, it works.
This is the code that comes right after this for doing the query on the user table (it's pulling a user ID from a cookie)
$query = "SELECT * FROM participants WHERE participantID = '.$participantid.'";
if (!$query){
exit('<p>Could not retrieve the data because: <b>'. mysql_error() . "</b>. The query was $query.</p>");
}
$row = mysql_fetch_assoc($query);
$participants =array();
$participants["prefix"] = $row["prefix"];
$participants["firstname"] = $row["firstname"];
$participants["middleinitial"] = $row["middleinitial"];
$participants["lastname"] = $row["lastname"];
This displays no data when calling the variable i.e.($participants) displays nothing.
Any help would be greatly appreciated.