Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default [PHP] Fetch - Error?

    I have the following code, and it keeps giving me this error:
    Parse error: syntax error, unexpected T_CHARACTER, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/stay/public_html/loser/admin/viewall.php on line 214
    Line 214 is:
    PHP Code:
    <div id=\"news_top\"><div align=\"left\"><div id=\"title\">$title - <a href=\"edit.php?id=<?php echo(\"\" . $fetch[\"id\"] . \"\");?>\">edit</a></div></div></div>
    +rep to all suggestions.

    PHP Code:
    <?php
    // Database
    include "config.php";

    // Lets check the mySQL
    $sql "SELECT * FROM news";
    $check mysql_query("SELECT id, title, name, date, post FROM news") or die("Onoes! Something is wrong! Please contact loserWILL for assistance (this is an error).");

    //Now, define the content variable(s)
    while ($display mysql_fetch_array($check)) {
    $title $display['title'];
    $name $display['name'];
    $date $display['date'];
    $post $display['post'];

    //Lets display it!
    echo "<div id=\"news_wrap\">
    <div id=\"news_top\"><div align=\"left\"><div id=\"title\">
    $title - <a href=\"edit.php?id=<?php echo(\"\" . $fetch[\"id\"] . \"\");?>\">edit</a></div></div></div>
    <div id=\"news_middle\"><div id=\"text2\">
    $post</div>
    <div id=\"etc\">Posted by: <strong>
    $name</strong> on <strong>$date</strong>.</div></div>
    <div id=\"news_bottom\"></div>
    </div>"
    ;
    }
    ?>
    Moved by Agesilaus (Forum Moderator) from Designing & Development: Please post in the correct forum next time.
    Last edited by Agesilaus; 02-01-2008 at 11:34 PM.

  2. #2
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Can you have '< , >' outside an echo in the middle of a php string?
    Last edited by Chippiewill; 02-01-2008 at 05:41 PM.
    Chippiewill.


  3. #3
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Okay, thanks.

  4. #4
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default

    <div id=\"news_top\"><div align=\"left\"><div id=\"title\">$title - <a href=\"edit.php?id=<?php echo("\" . $fetch[\"id\"] . \"\");?>\">edit</a></div></div></div>

    looking at your backslashes I asume the <div id=news etc is in an echo ?

    ifso just do:

    PHP Code:
    echo("

    <div id=\"news_top\"><div align=\"left\"><div id=\"title\">
    $title - <a href=\"edit.php?id=" $fetch[id] . "\">edit</a></div></div></div> 

    "
    ); 
    no need to backslash EVERY "

  5. #5
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Try this should work.

    PHP Code:
    <?php
    // Database
    include "config.php";

    // Lets check the mySQL
    $sql "SELECT * FROM news";
    $check mysql_query("SELECT id, title, name, date, post FROM news") or die("Onoes! Something is wrong! Please contact loserWILL for assistance (this is an error).");

    //Now, define the content variable(s)
    while ($display mysql_fetch_array($check)) {
    $title $display['title'];
    $name $display['name'];
    $date $display['date'];
    $post $display['post'];

    //Lets display it!
    echo "<div id=\"news_wrap\">
    <div id=\"news_top\"><div align=\"left\"><div id=\"title\">
    $title - <a href=\"edit.php?id=".$fetch['id']."\">edit</a></div></div></div>
    <div id=\"news_middle\"><div id=\"text2\">
    $post</div>
    <div id=\"etc\">Posted by: <strong>
    $name</strong> on <strong>$date</strong>.</div></div>
    <div id=\"news_bottom\"></div>
    </div>"
    ;
    }
    ?>

Posting Permissions

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