Jump to content

[SOLVED] how to join 2 querys


runnerjp

Recommended Posts

how could i join these 2 querys

$result1=mysql_query ("SELECT friendname FROM friends WHERE username='Admin' ORDER BY friendname"); 
$myrow1 = mysql_fetch_array ($result);
$friendname=$myrow1[friendname];
$result=mysql_query ("SELECT image FROM users WHERE friendname='$friendname'"); 

//loop statement 
while ($myrow = mysql_fetch_array ($result)) 
{ 
// this is the column 1 
if ($column == 1) 
{ 
printf("<tr><td><b></b>%s</td>",$myrow[image]); 

} 
else{ 
//this  is the column 2   
printf("<td><b></b>%s</td></tr>",$myrow[image]); 

} 
//increment the count 
$count += 1; 
// this is a modulus operator it gets the remainder of the equation 
$column = $count % 2; 
} 

?> 

 

so then i can echo out image??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.