I've recently started learning Javascript but still not a bit expert on the subject.
So I was wondering if anybody cloud help me out.
I'm building a portfolio site using MySql databases and PHP
My database table has 3 colons: name, small_image, description
.
I've set up my PHP so that it extracts the name
and the small_image
.
$name = htmlentities( $row['name'] );
$image_small = "images/" . $row['image_small'];
and it echo like this:
$name
< img src='$image_small' with='$width' height='$height' />
my only problem is that when I go to the admin page and add a new work with no image on the site it appears an empty space.
what I would like to do is to have an image that can be replacing the missing image?
is there a way to make it work? or a better, easy way to do so?
I really appreciate it .
Is not working here is the full code.
< - - - - - - - - - - - - - - - - - - - - FULL CODE - - - - - - - - - - - - - - - - >
// Loop through all of the records returned from the query
while( $row = mysql_fetch_array( $results ) ) {
// collect data from each field
$id = $row['id'];
$name = htmlentities( $row['name'] );
$desc_short = htmlentities( $row['desc_short'] );
if(isset( $row['image_small'])){
$image_small = "images/jewelry/small/" . $row['image_small'];
}
else{
$image_small = "images/blank.jpg";
}
echo "
<li class='column_$x $last_row_class'>
<a href='details.php?id=$id'>
<img src='$image_small' with='$width' height='$height' />
</a>
<p class='product_name'><a href='details.php?id=$id'>$name</a></p>
<p class='product_desc'>$desc_short</p>
$rating_div
</li>";