Matt,
> put two sets of data in the same while loop...
If there is some logical relationship between the sets of
records then consider adding a join:
$sql = "select club_full_name,message,messate_title "
" from clubs,noticeboard "
" where clubs.club_name = noticeboard.club_name and clubs.clubname =
'$id' ";
You can then iterate through this result:
$sth = mysql_query($sql);
$last = '';
while ($row = mysql_fetch_array($sql_result1)) {
if ( $last != $row[club_full_name] ) {
echo "<HR><B>$row["club_full_name"</B><BR>\n";
}
echo "$row[message_title] <I>$row[message]</I><BR>\n";
$last = $row["club_full_name"];
}
Regards
Jeff
-----Original Message-----
From: Matt Davis [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 21, 2001 10:23 AM
To: Php Mailing List
Subject: [PHP] can you have two sql statements on the same page.
I want to extract 2 sets of data each from different tables in the same db
but display the results on the same page at the same time. Can I just have
two sql statements like this or do I need to do something else.
//sql statement 1
$sql1 = "select club_full_name from clubs where club_name = '$id' ";
//sql statement 2
$sql2 = "select message,message_title from noticeboard where club_name =
'$id' ";
//execute sql1 query and get results
$sql_result1 = mysql_query($sql1);
//execute sql2 query and get results
$sql_result2 = mysql_query($sql2);
/*results
variables for data to be displayed*/
while ($row = mysql_fetch_array($sql_result1)) {
$name = $row["club_full_name"];
}
How can I put both sets of results in the while statement.
Any help would be kindly appreciated
Matt.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]