run 2 mysql_query's
Posted: Wed Feb 06, 2008 4:02 am
Hi all, i have just created a shoutbox using php & sql.
the output is put into tables by the echo feature.
what i would like to do is, place the users Email address (which is stored in a database) as the td title="" . The thing is though, that the data which i need to "grab" from the table is in a different table than the "shouts" (its in the login table). So i was wondering if i could have some code like the following:
any help please??
the output is put into tables by the echo feature.
what i would like to do is, place the users Email address (which is stored in a database) as the td title="" . The thing is though, that the data which i need to "grab" from the table is in a different table than the "shouts" (its in the login table). So i was wondering if i could have some code like the following:
Code: Select all
function getShouts()
{
$query = mysql_query("SELECT * FROM shouts ORDER BY id DESC LIMIT 25") or die(mysql_error());
$query1 = mysql_query("SELECT * FROM members") or die(mysql_error());
while ($row = mysql_fetch_array($query, $query1) )
{
$name = stripslashes($row['Shoutname']);
$contact = stripslashes($row['Contact']);
$shout = stripslashes($row['Shout']);
$email = stripslashes($row['Email']);
if(empty($contact))
{
echo '<tr><td title="'.$email.'" class="phpshout_posts"><p><span class="author"><a href="mailto:'.$contact.'">'.$name.'</a></span> - <span
class="shout">'.$shout.'<hr width=105 color=#ffffFF></span></p></td></tr>';
} else {
echo '<tr><td title="'.$domain.'" class="phpshout_posts"><p><span class="author"><a href="mailto:'.$contact.'" >'.$name.'</a></span> - <span
class="shout">'.$shout.'<hr width=105 color=#ffffFF></span></p></td></tr>';
}
}