Jump to content

[SOLVED] other image will not display


runnerjp

Recommended Posts

<?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

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\">";
}
}
?>

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\">";
}
}  ?>

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']."\">";
}
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.