Ämne: PHP hjälp
Visa ett inlägg
Oläst 2011-09-27, 13:17 #1
Hellsings avatar
Hellsing Hellsing är inte uppkopplad
Medlem
 
Reg.datum: Aug 2007
Inlägg: 194
Hellsing Hellsing är inte uppkopplad
Medlem
Hellsings avatar
 
Reg.datum: Aug 2007
Inlägg: 194
Standard PHP hjälp

Hallo!

Jag försöker skriva ut data från två tabeller i min MySQL i en array men gör något fel. Det finns säkert någon bättre metod att göra detta?

Kod:
// Select the ad from first table
$getads = mysql_query("SELECT * FROM wi1_posts WHERE post_status='publish' AND post_type='ad_listing' ORDER BY post_date DESC LIMIT 5"); 
while($row=mysql_fetch_array($getads)){

// Get image
$getimg = mysql_query("SELECT * FROM wi1_postmeta WHERE post_id=".$row['ID']." AND meta_key='_wp_attachment_metadata'"); 
while($row2=mysql_fetch_array($getimg)){
            
    echo '<h3>';
    echo $row['post_title'];
    echo '</h3>';
    echo $row2['meta_value'];
    echo "<br />";
    echo $row['post_date'];
    echo "<br />";
    echo $row['post_content'];
    echo "<br /><br /><br />";
}
}
Hellsing är inte uppkopplad   Svara med citatSvara med citat