G
ganda
Guest
How can i display my search result in PHP /MYSQL while loop in a horizontal table form. The fieldnames are the heading and the result in the search are their corresponding value.. I saw correct result but the table is repeated many times when the result is more than 1. That's why multiple table are displayed. but i only need one table together with the fields as the heading and only the <td> table data or the actual result(s) should be displayed:
This is the needed result:
Username Password
jake09 23232
jakeee 42232
the result should be like that and not:
Username jake09
Password 23232
Username jakeee
Password 42232
while($record=mysql_fetch_assoc($result))
{
while(list($fieldname,$fieldvalue) = each ($record))
{
echo "<table border=1 >";
echo "<tr>";
echo "<td>".$fieldname.": <b>" . $fieldvalue . "</b> " . "</td>";
echo "</tr>";
echo "</table>";
}
This is the code in my second representation, and my actually my problem. maybe in looping. Please help me.. Thanks..
This is the needed result:
Username Password
jake09 23232
jakeee 42232
the result should be like that and not:
Username jake09
Password 23232
Username jakeee
Password 42232
while($record=mysql_fetch_assoc($result))
{
while(list($fieldname,$fieldvalue) = each ($record))
{
echo "<table border=1 >";
echo "<tr>";
echo "<td>".$fieldname.": <b>" . $fieldvalue . "</b> " . "</td>";
echo "</tr>";
echo "</table>";
}
This is the code in my second representation, and my actually my problem. maybe in looping. Please help me.. Thanks..