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
cauri
Forum Newbie
Posts: 4 Joined: Thu Feb 26, 2004 9:04 am
Post
by cauri » Thu Feb 26, 2004 9:04 am
Very new to php.
I have a simple if statement but I keep gatting a parse error on the echo statements and I cannot see the fault:
Code: Select all
<?php
if (is_null($row_rsFoundContacts['subway_link'])) {
echo "Subway: {$row_rsFoundContacts['subway']}";
} else {
echo "Subway: "<a href='"$row_rsFoundContacts['subway_link']"'>"$row_rsFoundContacts['subway']"</a><br />;
}
?>
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Thu Feb 26, 2004 9:12 am
This line is a bit foobared:
Code: Select all
echo "Subway: "<a href='"$row_rsFoundContacts['subway_link']"'>"$row_rsFoundContacts['subway']"</a><br />;
you haven't got any concenation and the quoting's a bit shady, try this:
Code: Select all
echo 'Subway: <a href="'.$row_rsFoundContacts['subway_link'].'">'.$row_rsFoundContacts['subway'].'</a><br />';
Mac
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Thu Feb 26, 2004 9:12 am
try this out for size
Code: Select all
<?php
if (is_null($row_rsFoundContacts['subway_link'])) {
echo "Subway: {$row_rsFoundContacts['subway']}";
} else {
echo "Subway: <a href="".$row_rsFoundContacts['subway_link']."">".$row_rsFoundContacts['subway']."</a><br />";
}
?>
You need to escape your some of your literal quotes with a backslash.
Mark
Draco_03
Forum Regular
Posts: 577 Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada
Post
by Draco_03 » Thu Feb 26, 2004 9:17 am
i didn't test it bu i think this should work
Code: Select all
<?php
if (is_null($row_rsFoundContacts['subway_link'])) {
echo "Subway: {$row_rsFoundContacts['subway']}";
} else {
echo "Subway: <a href=".$row_rsFoundContacts['subway_link'].">".$row_rsFoundContacts['subway']."</a><br />";
}
?>
ahh i forgot the \" ... look at the post befor me..
cauri
Forum Newbie
Posts: 4 Joined: Thu Feb 26, 2004 9:04 am
Post
by cauri » Sat Feb 28, 2004 11:56 am
thank you. It works now. I'm learning.
cauri