Results 1 to 2 of 2

Thread: select statement

  1. #1
    Join Date
    Mar 2003
    Location
    ireland
    Posts
    7

    select statement

    hi.. i was wondering if anyone could help me???

    i have a login system using id which works... but when the person is logged in.. i want to display the information from the database which is relevant to that id..

    i have

    $query = "SELECT forename, surname, addL1, addL2, postalCode, county FROM student where id = '$_POST[id]'" ;

    while($row = @ mysql_fetch_array($result))
    {
    echo "\n<tr>\n<tg bgcolor=\"silver\">" .
    "<b><font color=\"black\">" .
    "<b>Forename:</b>" . " " . $row["forename"] . " " . "<br>" .
    "<b>Surname:</b>" . $row["surname"] . " " . "<br>" .
    "<b>Address Line1:</b>" . $row
    ["addL1"] . " " . "<br>" .
    "<b>Address Line2:</b>" . $row
    ["addL2"] . " " . "<br>" .
    "<b>Postal Code:</b>" . $row
    ["postalCode"] . " " . "<br>" .
    "<b>County:</b>" . $row["county"] . " " .
    "<font></b></td>\n<tr>";

    echo "\n<tr>\n\t<td></td>\n</tr>";
    }

    Any suggestions??
    Thanks,
    Susi

  2. #2
    Join Date
    Jan 2004
    Location
    Cincinnati, OH
    Posts
    30
    I do not know if you are receiving errors or just not receiving anything, but it looks like you need the following line after your "$query" assignment and before "while($row = @ mysql_fetch_array($result))":

    $result = mysql_db_query($dbname,$query)
    or die("<br>ERROR: Unable to Select records.<br>\n");

    Hope this helps.

Posting Permissions

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