Jump to content

OnTarget600

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by OnTarget600

  1. Thanks for you quick reply. Unfortunatly it appears the curly brace "{}" are meant to be. I changed them as per your suggestion and it broke completely. Eclipse also reports a syntax error when they are changed. I wont post the error as I don't want to confuse the issue. Here is the full code.

     

    $query = "SELECT * FROM people";

    $result = mysql_query($query);

    $my_rows;

     

    while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

    $my_rows = $my_rows. "Name : {$row['name']}
    " . "id : {$row['id']}

    ";

    }

     

    echo $my_rows;

     

    Thanks again.

  2. Hello,

     

    Continuing from the code above I am getting a notice. It still outputs the results after the notice. The notice line number suggests that it is this line:

     

    $my_rows = $my_rows. "Name : {$row['name']}
    " . "id : {$row['id']}

    ";

     

    I receive this error:

    Notice: Undefined variable: my_rows in /srv/www/htdocs/killerphp/database.php on line 23

     

    If I remove the second $my_rows variable the error goes away but so does the code functionality by only outputting the first db entry.

     

    I am using a standard LAMP stack with php 5.2.9

     

    Any ideas of why and if there is replacement code?

×
×
  • Create New...