Jump to content


Need help with PHP Script


8 replies to this topic

#1 iPod

    Young Padawan

  • Members
  • Pip
  • 63 posts
  • Location:Sweden

Posted 09 January 2006 - 03:56 PM

Me and my friend is making a site for fun, at first it was in HTML but now i'm recoding it in PHP. At the games-page I have got a problem.

This is the code.
<?php

echo '<center><font size="6"><b>Spel</b></font></center><br />';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.gorillaz.com/item.php?URL=xmas1" target="_blank"><img border="0" src="content/spel/img/sleigh.GIF" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Gorillaz Sleigh to go</font><br />';
echo '<font size="2">Flyg &ouml;ver husen f&ouml;r att sl&auml;nga ner presenter i skorstenarna. Om du inte &aring;ker tillr&auml;ckligt n&auml;ra skorstenarna s&aring; missar';
echo ' jultomten och farten &ouml;kar.<br><br>Klicka f&ouml;r att &aring;ka upp&aring;t.<br /><br />V&auml;rldens';
echo ' b&auml;sta spelare har f&aring;tt 9214 po&auml;ng och Bullenbakis har lyckats f&aring; 3478 poäng.</font><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.gorillaz.com" target="_blank">www.gorillaz.com</a></font></td>';
echo '</table>';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.gorillaz.com/o/shootingRange/index.html" target="_blank"><img border="0" src="content/spel/img/pontiac.GIF" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Shooting Range</font><br />';
echo '<font size="2">Skjut s&aring; m&aring;nga m&aring;ltavlor som m&ouml;jligt';
echo ' men skjut inte p&aring; bomberna. Den roligaste niv&aring;n &auml;r n&auml;r du p&aring; 20 sekunder ska demolera en Pontiac!</font><br /><br /><br /><br /><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.gorillaz.com" target="_blank">www.gorillaz.com</a></font></td>';
echo '</table>';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.gorillaz.com/item.php?N=pong&URL=pong" target="_blank"><img border="0" src="content/spel/img/pong.GIF" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Pong</font><br />';
echo '<font size="2">Detta &auml;r ett twoplayer-spel. Ni ska sl&aring; bollen fram och tillbaka &ouml;ver spelplanen precis som vanligt.';
echo ' Den v&auml;nstra spelaren anv&auml;nder knapparna A och Z och den h&ouml;gra spelaren anv&auml;nder K och M.';
echo '</font><br /><br /><br /><br /><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.gorillaz.com" target="_blank">www.gorillaz.com</a></font></td>';
echo '</table>';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.gorillaz.com/item.php?N=russelSays&URL=russelSays" target="_blank"><img border="0" src="content/spel/img/russel.GIF" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Russel Says</font><br />
echo '<font size="2">S&auml;g efter Russel. Det blir sv&aring;rare och sv&aring;rare. Klicka p&aring; de fyra knapparna precis som de blinkar innan. Det finns m&aring;nga spel liknande det h&auml;r.';
echo '</font><br /><br /><br /><br /><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.gorillaz.com" target="_blank">www.gorillaz.com</a></font></td>';
echo '</table>';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.gorillaz.com/item.php?N=potato&URL=potato" target="_blank"><img border="0" src="content/spel/img/potato.GIF" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Potato Game</font><br />';
echo '<font size="2">Du ska skala en potatis s&aring; snabbt som m&ouml;jligt. H&aring;ll in musknappen medan du drar s&aring; g&aring;r det snabbare. Beh&ouml;ver vi säga mer?';
echo '</font><br /><br /><br /><br /><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.gorillaz.com" target="_blank">www.gorillaz.com</a></font></td>';
echo '</table>';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.gorillaz.com/item.php?N=Froggaz&URL=Froggaz" target="_blank"><img border="0" src="content/spel/img/groda.JPG" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Froggaz</font><br />';
echo '<font size="2">Du ska med grodan hoppa &ouml;ver v&auml;gen utan att bli &ouml;verk&ouml;rd och sedan &ouml;ver &aring;n utan att trilla i plurret. D&auml;r ska du ta';
echo ' en flaska kemikalier och sen hoppa tillbaka igen. G&ouml;r s&aring; tills glaset &auml;r fullt.';
echo '</font><br /><br /><br /><br /><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.gorillaz.com" target="_blank">www.gorillaz.com</a></font></td>';
echo '</table>';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.gorillaz.com/item.php?N=attache&URL=attache" target="_blank"><img border="0" src="content/spel/img/vaska.JPG" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Attache</font><br />';
echo '<font size="2">Du ska f&ouml;rs&ouml;ka pussla in alla Murdocs saker i v&auml;skan. Du har tre ledtr&aring;dar men det &auml;r &auml;nd&aring; ett v&auml;ldigt klurigt spel. Du kommer tr&auml;ffa p&aring; en del underliga saker att b&auml;ra runt p&aring;!';
echo '</font><br /><br /><br /><br /><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.gorillaz.com" target="_blank">www.gorillaz.com</a></font></td>';
echo '</table>';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.gorillaz.com/item.php?N=darts&URL=darts" target="_blank"><img border="0" src="content/spel/img/dart.JPG" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Darts</font><br />';
echo '<font size="2">Tradionellt Dart-spel. Du kan v&auml;lja om du vill vara en, tv&aring; eller tre spelare. Det finns tre "Game Modes". V&auml;lj mellan 301, Around the Clock eller Around the clock Double Trouble.';
echo ' Du kan ocks&aring; v&auml;lja mellan tre olika s&auml;tt att sikta p&aring;.';
echo '</font><br /><br /><br /><br /><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.gorillaz.com" target="_blank">www.gorillaz.com</a></font></td>';
echo '</table>';
echo '<table width="99%" height="205px" bgcolor="#EFEFEF" border="1">';
echo '<td><a href="http://www.hamsterpaj.net/amusefiles/view_item.php?id=402&type=1" target="_blank"><img border="0" src="content/spel/img/blackknight.JPG" height="200px" width="250px" /></a></td>&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">The Black Knight</font><br />';
echo '<font size="2">Du &auml;r en riddare som p&aring; uppdrag av kungen ska sp&ouml;a skiten ur b&ouml;nderna f&ouml;r att f&aring; tillbaka skatten som de inte betalar. Du samlar pengar och efter varje bana s&aring; kan du k&ouml;pa nya vapen f&ouml;r de pengar du samlat.';
echo '</font><br /><br /><br /><br /><br /><br /><br /><br /><font size="1">Spelet &auml;r fr&aring;n <a href="http://www.hamsterpaj.net" target="_blank">www.hamsterpaj.net</a></font></td>';
echo '</table>';
echo '</p>';
echo '<div class="story"></div>';
echo '<div class="story"></div>';
echo '</div>';

?>

and this is the error message.
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /var/www/hotserv.dk/users/ipodstudios/bigmamastudios/bbtest/content/spel/index.php on line 27
which is weird because the is a ";" at line 27.

I hope someone can help, because I've promised to be ready with the site tomorrow.

Thank You
iPod

Nope I made a mistake. Sorry for this post, please just remove it.

Thank you.

#2 Jaymz

    Retired P2L Staff

  • Members
  • PipPipPipPip
  • 4,104 posts

Posted 09 January 2006 - 03:58 PM

You forgot to close line 25 :tiphat:

echo '<td cellspacing="0" cellpadding="0" valign="top"><font size="4">Russel Says</font><br />

Also, you don't need all those echos, you can echo a whole block of stuff at once, no need for separate echos per line :)

<?php echo '

Blah<br>
My text here<br>
Etc'; ?>

Edited by Jaymz, 09 January 2006 - 04:00 PM.


#3 iPod

    Young Padawan

  • Members
  • Pip
  • 63 posts
  • Location:Sweden

Posted 09 January 2006 - 04:10 PM

Yeah. I know but I feel more comfortable with one per line. Thanks for your help anyway.

#4 zhanster

    Young Padawan

  • Members
  • Pip
  • 125 posts

Posted 10 January 2006 - 01:34 AM

Hmmm, do your really need the echos? You can just write the majority in html and have little islands of PHP when you need them?

#5 iPod

    Young Padawan

  • Members
  • Pip
  • 63 posts
  • Location:Sweden

Posted 10 January 2006 - 02:29 AM

I know that too but I like to write it in only PHP.

#6 dEcade

    P2L Staff

  • P2L Staff
  • PipPipPipPip
  • 1,850 posts
  • Gender:Male
  • Location:Saskatoon, Saskatchewan
  • Interests:Guitar, Programming, Storm Chasing, Games (Designing and playing), Hockey, Photography

Posted 10 January 2006 - 07:25 PM

You know that you can just use one echo and if there is a word like "don't" that has a ' in it just do it like this:

<?php
echo 'this is what don\'t would look like';
?>

just put a back slash "\"

dEcade

#7 tiki

    Young Padawan

  • Members
  • Pip
  • 259 posts
  • Gender:Male
  • Location:California

Posted 10 January 2006 - 11:23 PM

Why are you echoing it all in an echo, when to me it looks like theres no php within the echos at all, kind of pointless.

#8 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 11 January 2006 - 11:45 AM

Well, if he feels more comfortable with one per line, let him :)

#9 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 11 January 2006 - 05:01 PM

This topic has been solved already. Even if there is an easier way then what he is doing, it's the way he's doing it, and he knows there is another option.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users