Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: T_string

  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    T_string

    Make up coding this code, but when runnig this code, php says this:

    Parse error: syntax error, unexpected T_STRING in /home/jiminet/www/chat.php on line 6


    Code:

    Code:
    <?php 
    include("check.php");
    $_POST['message'];
    $file = fopen("messages.txt","w");
    $line = $tunnus |  $message
    fwrite($file, $line);
    fclose($file);
    header("Location: http://jiminet.jouluserver.com/chat.html")
    ?>
    How to fix this problem?

    My english is bad, when live in Finland.
    Last edited by pake10; 09-04-2009 at 08:23 PM.

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Code:
    <?php 
    include("check.php");
    $_POST['message'];
    $file = fopen("messages.txt","w"); 
    $line = $tunnus |  $message; /*** <<< ***/
    fwrite($file, $line);
    fclose($file);
    header("Location: http://jiminet.jouluserver.com/chat.html")
    ?>
    Are you a Help Vampire?

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    There needs to be quotes in there on this line.
    PHP Code:
    $line $tunnus." | ".$message
    Last edited by _Aerospace_Eng_; 09-04-2009 at 11:06 PM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    Regular Coder
    Join Date
    Dec 2008
    Posts
    116
    Thanks
    11
    Thanked 4 Times in 4 Posts
    I think he frogot the " ; " on
    Code:
    header("Location: http://jiminet.jouluserver.com/chat.html")

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The last ; before the closing ?> tag isn't necessary though it is good habit.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Regular Coder mOrloff's Avatar
    Join Date
    Nov 2008
    Location
    The Great Pacific NW, USA
    Posts
    422
    Thanks
    8
    Thanked 6 Times in 6 Posts
    So, to put everyone elses great suggestions all together:
    Code:
    <?php 
    include("check.php");
    $_POST['message'];
    $file = fopen("messages.txt","w");
    $line = $tunnus." | ". $message;       <-------<<<  2 fixes
    fwrite($file, $line);
    fclose($file);
    header("Location: http://jiminet.jouluserver.com/chat.html");       <-------<<<  1 fix
    ?>

  • #7
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mOrloff View Post
    So, to put everyone elses great suggestions all together:
    Code:
    <?php 
    include("check.php");
    $_POST['message'];
    $file = fopen("messages.txt","w");
    $line = $tunnus." | ". $message;       <-------<<<  2 fixes
    fwrite($file, $line);
    fclose($file);
    header("Location: http://jiminet.jouluserver.com/chat.html");       <-------<<<  1 fix
    ?>

    Now says this:

    Code:
    Warning: fwrite(): supplied argument is not a valid stream resource in /home/jiminet/www/chat.php on line 6
    
    Warning: fclose(): supplied argument is not a valid stream resource in /home/jiminet/www/chat.php on line 7
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/jiminet/www/chat.php:6) in /home/jiminet/www/chat.php on line 8

    How to fix?

  • #8
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Add
    PHP Code:
    ini_set('display_errors',1);
    ini_set('display_startup_errors',1);
    error_reporting (E_ALL); 
    at the top of your code and see if there's any error message.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #9
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    Add
    PHP Code:
    ini_set('display_errors',1);
    ini_set('display_startup_errors',1);
    error_reporting (E_ALL); 
    at the top of your code and see if there's any error message.
    Says this:

    Parse error: syntax error, unexpected T_STRING in /home/jiminet/www/chat.php on line 9

    How to fix?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •