Im trying to create this thing that if its get nothing from a array it would bring up a default picture but its not working out the way i want it to. It using every array but i want to separate each away.
$result = mysql_query("SELECT * FROM `im_album` WHERE username = '".$user_data['username']."' ");
$d_name = array();
$d_amount = array();
$d_cover = array();
while(($row = mysql_fetch_assoc($result))) {
$d_name[] = $row['name'];
$d_mode[] = $row['mode'];
$d_amount[] = $row['amount'];
$d_cover[]= $row['cover'];
}
$p_cover = implode($d_cover) ;
if ( $p_cover == "") {
$p_cover = "cpages/img/default_pic.jpg";
}
else
{
$p_cover= "userdata/".$user_data['username']."/profilepic/".$p_cover;
}
<img style="margin:2pt" src="<?php echo $p_cover ?>" height="250" width="200" />
1 Answer