# Miscellaneous > Database Programming >  select statement

## susi

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

----------


## ccalender

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.

----------

