Hello again,
I'm using a MySQL database and I want to pull results from the database and put them onto a php page. I've currently got it working using the following code, but it's not exactly what I want:
$query = 'SELECT * FROM loan';
$result = mysql_query($qu ery) or die('No Loans Found: ' . mysql_error());
// Printing results in HTML
echo "<table>";
while ($line = mysql_fetch_arr ay($result, MYSQL_ASSOC)) {
echo "<br>\t<tr> \n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_v alue</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
Basically, I want the table to have a border and a background, but no matter what I try it just messes the code up so it no longer works.
Can anyone throw me a few pointers?
Thanks.
I'm using a MySQL database and I want to pull results from the database and put them onto a php page. I've currently got it working using the following code, but it's not exactly what I want:
$query = 'SELECT * FROM loan';
$result = mysql_query($qu ery) or die('No Loans Found: ' . mysql_error());
// Printing results in HTML
echo "<table>";
while ($line = mysql_fetch_arr ay($result, MYSQL_ASSOC)) {
echo "<br>\t<tr> \n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_v alue</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
Basically, I want the table to have a border and a background, but no matter what I try it just messes the code up so it no longer works.
Can anyone throw me a few pointers?
Thanks.
Comment