Results 1 to 3 of 3

Thread: error check

  1. #1
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default error check

    anyone find errors?

    PHP Code:
    <?php
    include 'config.php';

    $query  "SELECT name, lname, age, color, friend, pet, sib, ftown, htown, stat, sex, gr, school FROM profile";
    $result mysql_query($query);

    while(
    $row mysql_fetch_array($resultMYSQL_ASSOC))
    {
        echo 
    "First Name:{$row['name']} <br>" .
             
    "Last Name: {$row['lname']} <br>" .
    "Age:{$row['age']} <br>" .
             
    "Status: {$row['stat']} <br>" .
    "Grade:{$row['gr']} <br>" .
             
    "School: {$row['school']} <br>" .         
               
    "Gender:{$row['sex']} <br>" .
             
    "Fav Town: {$row['ftown']} <br>" .
    "Hometown:{$row['htown']} <br>" .
             
    "Fav Color: {$row['color']} <br>" .
    "Best Friend(s):{$row['friend']} <br>" .
             
    "Pets: {$row['pets']} <br>" .
    "Siblings: {$row['sib']} <br><br>";
    }
    ?>
    it works fine like this:
    PHP Code:
    $query  "SELECT name, lname , age, stat, sex, gr, ftown, htown, sib FROM profile";
    $result mysql_query($query); 
    but when i add the rest it doenst?

    Edited by L&#181;ke (Forum Moderator): Thread Moved From Website Designing. Please post in the correct section next time, Thanks .
    Last edited by Lµke; 10-03-2007 at 10:43 PM.

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  2. #2
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    Don't know why but
    Code:
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    Doesn't look right. Also do you need the {} around the rows.


  3. #3
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    all that is fine?
    it just gives errors if i change:
    $query = "SELECT name, lname , age, stat, sex, gr, ftown, htown, sib FROM profile";
    $result = mysql_query($query);
    to
    $query = "SELECT name, lname, age, color, friend, pet, sib, ftown, htown, stat, sex, gr, school FROM profile";
    $result = mysql_query($query);

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


Posting Permissions

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