Hi Everyone. Just when i feel like your learning something i get stuck at a such a simple concept (i think).
Basically i am learning by creating my own profile website etc etc.
If a user hasnt yet uploaded an image i wan to display a default image. below is what i have so far that seems to work but doesnt display the default image if missing.
[php]<?php
require ‘incs/logged_in.php’;
require ‘incs/dbc.php’;
$user_email = $_SESSION[‘user’];
//execute the SQL query and return records
$query = “SELECT id,user_email,full_name,main_image FROM users WHERE
user_email = ‘$user_email’ AND user_activated=‘1’”;
$result = mysql_query($query) or die(“Could not select from table”);
$row = mysql_fetch_array($result)
?>
<?php if (isset($_SESSION['user'])) { ?>
Welcome <?php echo $_SESSION['user']; ?>
<?php } ?> </div>
</div>
<ul id="promobox2">
<li>
<h3>Profile Image</h3>
<ul>
<?php
if ($row[main_image] !=="NULL"){
echo "<img src=\"profile_images/". $row['main_image'] ."\"/>";
}else
{echo "<img src=\"images/unkown-person.jpg". $row['main_image'] ."\"/>";
}
?>[/php]
Any help on this would be great.