if != question

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
jarow
Forum Commoner
Posts: 83
Joined: Tue Jan 28, 2003 2:58 am

if != question

Post by jarow »

Can´t figure out what is wrong with the following...it won´t print out any values.

Code: Select all

<?php
if ($row_rsdetail['syn'] != ""){echo "$row_rsdetail['syn'] <BR>\n"; } 
if ($row_rsdetail['syn1'] != ""){echo "$row_rsdetail['syn1'] <BR>\n"; } 
?>
Many thanks
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

You can allso use isset() or empty().
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you done:

Code: Select all

echo '<pre>';
print_r($row_rsdetail);
echo '</pre>';
to check values?

Mac
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Ah, there is one major problem with your code, you can't do:

Code: Select all

echo "$array['key'] other text";
you can do:

Code: Select all

echo $array['key'].' other text';
or

Code: Select all

echo "$array[key] other text";
or

Code: Select all

echo "{$array['key']} other text";
Mac
jarow
Forum Commoner
Posts: 83
Joined: Tue Jan 28, 2003 2:58 am

Post by jarow »

thanks mac...once again your info has helped me alot
Post Reply