Bluehost.com Web Hosting $6.95

What is wrong with my script?

This is a discussion on What is wrong with my script? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; <?php $lines = file('http://tibia.4players.de/statistics/?subtopic=whoisonline&world=Nova') ; $charname = $_POST['char_name']; for ($i=0; $...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2004
Andreas Saarva
 
Posts: n/a
Default What is wrong with my script?

<?php
$lines =
file('http://tibia.4players.de/statistics/?subtopic=whoisonline&world=Nova')
;

$charname = $_POST['char_name'];

for ($i=0; $i<count($lines);$i++) {
if (stristr ($lines[$i], $charname)) {
str_replace ($charname, "<span
style="color:green;">"$charname"</span>"); }
echo $lines[$i];
}
?>

Parse error: parse error, unexpected T_STRING in
c:\program\easyphp1-7\www\test\test1.php on line 8


What is wrong?

Sincerely,
Andreas Saarva.


Reply With Quote
  #2 (permalink)  
Old 02-26-2004
Cameron
 
Posts: n/a
Default Re: What is wrong with my script?

Andreas Saarva wrote:
> <?php
> $lines =
> file('http://tibia.4players.de/statistics/?subtopic=whoisonline&world=Nova')
> ;
>
> $charname = $_POST['char_name'];
>
> for ($i=0; $i<count($lines);$i++) {
> if (stristr ($lines[$i], $charname)) {
> str_replace ($charname, "<span
> style="color:green;">"$charname"</span>"); }
> echo $lines[$i];
> }
> ?>
>
> Parse error: parse error, unexpected T_STRING in
> c:\program\easyphp1-7\www\test\test1.php on line 8
>
>
> What is wrong?
>
> Sincerely,
> Andreas Saarva.
>
>


If you need to use double quotes within a double quotes string you need
to escape them so...

"<span style=\"color:green;\"...etc

~Cameron
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:15 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0