What's wrong with this

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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

What's wrong with this

Post by John Cartwright »

Code: Select all

<?php
	 echo "<table align="center">\n"
	 ."<tr>\n"
	 ."<td>\n";
	 	
if (isset($moreinfo){ ?>
		<a href="javascript:void(0)" onClick="javascript:window.open('news.php?id=<?php echo $id ?>','myWindow','width=500','height=500');">To get more information click</a>
<? }else{
			echo "";
		}
echo "</td>\n"
	 ."</tr>\n"
	 ."</table>\n"
	 ."<br>\n";
?>
I been staring at code all day and I believe I have lost my mind :D

Plz help I am getting parse error ty
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I had a professor in university that would do this - give us some code, not tell us what it's supposed to do, and expect us to fix it. Ya, he wasn't a popular guy. Maybe if you gave us a little more info it'd be easier for us to help. (This is meant in jest..... the part about my professor, not the part about wanting more info).
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

May if you read the code you would know what it did

its a table

in 1 row is checks if $moreinfo is set -if it is shows a link
-if not does nothing

Not very hard to understand is it?

And I also said what my problem is... I'm getting a parse error.
TY... think before you type.
Last edited by John Cartwright on Fri Jan 30, 2004 5:57 pm, edited 1 time in total.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

I agree with pickle, but I also don't see anything wrong with it, aside from the fact that your ELSE is totally extraneous. But that won't affect anything. View source.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

Hey, here's a wacky idea... if you're getting a parse error, why don't you TELL US WHAT IT IS.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

nvm in if (isset($moreinfo) I changed it to if (isset($moreinfo))
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

My parse error was

Parse Error: parse error.

problem solve no more talkig ty
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

Then you need to fix your error reporting. You should be getting plenty of information more than that, most especially LINE NUMBERS that would have shown you the problem right away.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You post a code snippet that looks fine, refuse to give the the full error and when you solve the problem don't bother saying what you did. Please read the posting guidelines (first link in my sig).

We are all volunteers here and you are not the only person who needs help, you have to help us help you. You too should think before you type.

Mac
Post Reply