Results 1 to 6 of 6

Thread: Whats wrong...

  1. #1
    Join Date
    Jan 2004
    Location
    Ellesmere Port, Wirral, UK
    Posts
    1,541

    Whats wrong...

    PHP Code:
    <?php

    include("header.php");
    include(
    "connect.php");

    $query mysql_query("select maxno from news limit 1");
           
    $result mysql_query('$query');
                   while(
    $maxno mysql_fetch_array($query));


    $query mysql_query("select * from news order by date desc limit $maxno");
    $result mysql_fetch_array($query));
                   
    extract($result) {

    $date $row['date'];
    $title htmlentities ($row['title']);
    $news nl2br (strip_tags ($row['news']));
    echo(
    "<b>$title on $date<BR><BR>$news</b>");

    }

    ?>

    This thing refuses to work, i know theres likely to be basic mistakes in here....but im new to php

    Thanks, Philip
    Last edited by Philipf; 02-06-2004 at 04:07 PM.

  2. #2
    Join Date
    Feb 2003
    Location
    Virginia
    Posts
    237
    You had some extra stuff going on in your code. Give this a try:

    PHP Code:
    <?php

    include("header.php");
    include(
    "connect.php");

    $query mysql_query("select maxno from news limit 1");
    $result mysql_query('$query');
    list(
    $maxno) = mysql_fetch_array($query);


    $query mysql_query("select * from news order by date desc limit $maxno");
    while (
    $result mysql_fetch_array($query)) {
    extract($result

    $title htmlentities ($title);
    $news nl2br (strip_tags ($news));
    echo 
    "<b>$title on $date<BR><BR>$news</b>";
    }
    ?>
    Protollix - Sean Finkel
    Email
    Website
    Shared Hosting :: Cloud Hosting

  3. #3
    Join Date
    Jan 2004
    Location
    Ellesmere Port, Wirral, UK
    Posts
    1,541
    Parse error: parse error in /home2/btihost/public_html/psfnews/main.php on line 12

    same as before

    Thanks, Philip

  4. #4
    Join Date
    Jan 2002
    Location
    Ohio
    Posts
    3,127
    Originally posted by Protollix
    You had some extra stuff going on in your code. Give this a try:

    PHP Code:
    <?php

    include("header.php");
    include(
    "connect.php");

    $query mysql_query("select maxno from news limit 1");
    $result mysql_query('$query');
    list(
    $maxno) = mysql_fetch_array($query);


    $query mysql_query("select * from news order by date desc limit $maxno");
    while (
    $result mysql_fetch_array($query)) {
    extract($result); // Missing semi-colon

    $title htmlentities ($title);
    $news nl2br (strip_tags ($news));
    echo 
    "<b>$title on $date<BR><BR>$news</b>";
    }
    ?>
    You were missing a semi-colon with the extract($result) line.
    Glioblastoma Multiforme (GBM) Brain Cancer Awareness. May is Brain Cancer awareness month. Gray Matters!
    Incurable, 6-18 months prognosis, survivors longer than 3 years less than 1% chance.
    Don't like what I say? Ignore me.

  5. #5
    Join Date
    Jan 2004
    Location
    Ellesmere Port, Wirral, UK
    Posts
    1,541
    And an extra ) on line 12

  6. #6
    Join Date
    Jan 2004
    Location
    Ellesmere Port, Wirral, UK
    Posts
    1,541
    Thanks for the help guys, got it almost working

  7. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Related Posts from theWHIR.com

Posting Permissions

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