Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/patriot/publ

  1. #1
    patriotcow D-A-L Guest

    Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/patriot/publ

    I am having a problem with a piece of code anyone see any problems in this code, it basically submits the data into the database.

    PHP Code:
     <?php
     
    require_once("./connect.php");
     
    ?>
     <form action="<?php echo $_server['PHP_SELF']; ?> method="post">
     <label>Insert news here:<br />
     <textarea mame="newstext" rows="10" cols="40">
     </textarea></label><br />
     <input type="submit" value="SUBMIT" />
     </form>
     <?php
     
    if (isset($_POST['newstext'])) {
     
    $newstext $_POST[newstest]';
     $sql = "INSERT INTO news SET
     newstext='
    $newstext',
     if (@mysql_query($sql)) {
     ecbo '
    <p>News had been submitted</p>';
     } else {
     echo '
    <p>Error adding news' .
     mysql_error() . '
    </p>;
     }
     }
     
    ?>


  2. #2
    D-A-L is offline D-A-L Administrator
    Did the error have a line number?

    This line looks like it needs closing...sure it's correct?

    Code:
    $sql = "INSERT INTO news SET

  3. #3
    patriotcow D-A-L Guest
    Ive done it now, vbulletinstudio.com its just that simple thing on the side but has alot to be done yet
    In the end I ended up with a nicer smaller code, done by me I feel proud lol.
    PHP Code:
     <?php
     
     
    require_once("./connect.php");
     
    $result = @mysql_query('SELECT newstext FROM news');
     if (!
    result) {
     exit(
    '<p>Error performing fetch from database: ' mysql_error () . '</p>');
     }
     
     while (
    $row mysql_fetch_array($result)) {
     echo 
    '<p>' $row['newstext'] . '</p>';
     }
     
     
    ?>

  4. #4
    patriotcow D-A-L Guest
    Tackle the Web with $5.99 .COM's from Go Daddy!
    added a function to stop html being processed, stupid people adding redirects taking over my sites

    quite good: $newstext = htmlspecialchars($newstext);

+ Reply to Thread