PDA

View Full Version : Parse Error


Protege
11-16-2004, 12:28 AM
I am using the following code to create a javascript random quote generator.
I, however, always get this error:
Parse error: parse error, unexpected T_STRING in /home/cgacom/public_html/quote.php on line 23
Line 23 is blank.

Here is the code.

<html>
<head>
</head>
<body>
<?php

$quotes[0] = "<p>DibbLe: ive come to a realization</p>
<p>Daemonite: ?</p>
<p>DibbLe: violent games like cs, bf1942 and quake DO influence kids to shoot people and commit violent acts</p>
<p>DibbLe: but not because theyre imitating the game, its because everyone who plays them acts SO ****ING STUPID YOU HOPE
THEY ALL DIE</p>";

$quotes[1] = "<p>xterm: The problem with America is stupidity. I'm not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself?</p>";

$quotes[2] = "<p>anamexis: oh man</p>
<p>anamexis: I was opening a coke, right</p>
<p>Beefpile (~mbeefpile@cloaked.wi.rr.com) has joined #themacmind</p>
<p>anamexis: and it exploded</p>
<p>anamexis: ALMOST all over my keyboard</p>
<p>anamexis: but I got it away just in time</p>
<p>Beefpile has quit (sick ****ers</p>";

$quotes[3] = "<p>AgentSmith: It seems you have been leading two lives, Mr. Anderson. In one life, you are Robert Anderson, assistant cook at a Jack in the Box in Mesquite....in the other...you go by the chat alias "Randerson"...spreading homosexual propoganda, lying, and being a generally immature pest...</p>
<p>AgentSmith: One of these...has a future.</p>
<p>Randerson: LMAO OMFG where's the phone, I have to tell Dean about this</p>
<p>AgentSmith: How can you use the phone when you cannot...speak?</p>
<p>*** AgentSmith sets mode: +m</p>";

$quotes[4] = "<p>Th3No0b: Im going to be the next hitler</p>
<p>Th3No0b: Im going to kill all the jews and 1 clown</p>
<p>RageAgainsttheAmish: why the clown</p>
<p>Th3No0b: See? no one cares about the jews</p>
<p>RageAgainsttheAmish: lmao</p>";

$quotes[5] = "scirDSL: <p>I hated going to weddings. All the grandmas would poke me saying "You're next". They stopped that, when I started doing it to them at funerals.</p>";

srand ((double) microtime() * 1000000);
$randomquote = rand(0,count($quotes)-1);

echo "" . $quotes[$randomquote] . "";

?>
</body>
</html>

Fou-Lu
11-16-2004, 04:15 AM
You need to escape this code:

.....
Anderson, assistant cook at a Jack in the Box in Mesquite....in the other...you go by the chat alias \"Randerson\"...spreading
.....
// And here:
$quotes[5] = "scirDSL: <p>I hated going to weddings. All the grandmas would poke me saying \"You're next\". They stopped that, when I started doing it to them at funerals.</p>";


You cannot have double quotes inside double quotes, or single inside single quotes without escaping them.

EDIT: Both of those need to be esaped, \" but it strips it out when its formated for the php in the vb3. Never new that before. View as a quote to see what I mean.

Protege
11-16-2004, 07:36 AM
Thanks that worked.

-Protege-