runnerjp Posted May 17, 2008 Share Posted May 17, 2008 <?php $q = mysql_query($sql) or die("Error running query:".mysql_error()); if($q && mysql_num_rows($q) > 0) { $row = mysql_fetch_array($q); if(!empty($row)) { echo "<img src='http://www.members/images/thumbs/". $pid . "." . $row['ext'] . "'"; } else { echo "<img src='http://www./members/images/thumbs/big.jpg"; } } ?> my image for echo "<img src='http://www./members/images/thumbs/". $pid . "." . $row['ext'] . "'"; will display if the users has an image uploaded but if not it displays nothing when it should echo echo "<img src='http://www./members/images/thumbs/big.jpg"; ?? Link to comment https://forums.phpfreaks.com/topic/106050-solved-other-image-will-not-display/ Share on other sites More sharing options...
AndyB Posted May 17, 2008 Share Posted May 17, 2008 http://www./members makes no sense. Let's assume it's a copying error. Fix it and try again. Link to comment https://forums.phpfreaks.com/topic/106050-solved-other-image-will-not-display/#findComment-543510 Share on other sites More sharing options...
runnerjp Posted May 17, 2008 Author Share Posted May 17, 2008 sorry i fotgot to type in mywebsite.com lol any reaosn why it hould not work then at all :s Link to comment https://forums.phpfreaks.com/topic/106050-solved-other-image-will-not-display/#findComment-543515 Share on other sites More sharing options...
ShimmyShine Posted May 17, 2008 Share Posted May 17, 2008 I am assuming members.com isn't yours so I fixxed up the code as much as I could. <?php $q = mysql_query($sql) or die("Error running query:".mysql_error()); if($q && mysql_num_rows($q) > 0) { $row = mysql_fetch_array($q); if(!empty($row)) { echo "<img src=\"./members/images/thumbs/".$pid.".".$row['ext']."\">"; } else { echo "<img src=\"./members/images/thumbs/big.jpg\">"; } } ?> Link to comment https://forums.phpfreaks.com/topic/106050-solved-other-image-will-not-display/#findComment-543520 Share on other sites More sharing options...
runnerjp Posted May 17, 2008 Author Share Posted May 17, 2008 humm it still does noit display echo "<img src=\"./members/images/thumbs/big.jpg\">"; strange :S <?php $q = mysql_query($sql) or die("Error running query:".mysql_error()); if($q && mysql_num_rows($q) > 0) { $row = mysql_fetch_array($q); if(!empty($row)) { echo "<img src=\"http://www.my.com/members/images/thumbs/".$pid.".".$row['ext']."\">"; } else { echo "<img src=\"http://www.my.com/members/images/thumbs/big.jpg\">"; } } ?> Link to comment https://forums.phpfreaks.com/topic/106050-solved-other-image-will-not-display/#findComment-543543 Share on other sites More sharing options...
ShimmyShine Posted May 17, 2008 Share Posted May 17, 2008 Try this one: <?php $q = mysql_query($sql) or die("Error running query:".mysql_error()); $array = mysql_fetch_array($q); if(!$q || mysql_num_rows($q) <= 0) { echo "There was an error."; } else { if(!$array) { echo "<img src=\"http://www.my.com/members/images/thumbs/big.jpg\">"; } else { echo "<img src=\"http://www.my.com/members/images/thumbs/".$pid.".".$array['ext']."\">"; } } ?> Link to comment https://forums.phpfreaks.com/topic/106050-solved-other-image-will-not-display/#findComment-543546 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.