More if problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
randall
Forum Newbie
Posts: 16
Joined: Fri May 08, 2009 9:01 pm

More if problems

Post by randall »

I am having a problem with this code, it is not echoing null when there is not no db entry.

Code: Select all

 
 
<?php
if ($art=Unknown) { 
echo " "; 
}
else { 
echo "Artist: ";
} 
?>
</b></font>
 
<?php
if ($art=Unknown) { 
echo " "; 
}
else { 
echo "$artist";
} 
 
?>
 
<?php 
if (!$art) { 
echo " "; 
}
else { 
echo "$artist"; 
}
?>
 
<?php 
if (!$art) { 
echo " "; 
}
else { 
echo "<br>"; 
}
?>
 
 
<!--End artist -->
 
 
Last edited by Benjamin on Tue May 19, 2009 2:30 pm, edited 1 time in total.
Reason: Changed code type from text to php.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: More if problems

Post by John Cartwright »

Post all the relevant code.

What is "Unknown"? Is it a constant or is it support to be a string? Lastly, you need to understand the difference between assignment operators and comparison operators.
Post Reply