Hi, I’ve been using asp for a while and now learning php, and have become stuck.
I want to display the results from my query over 4 columns in a loop, I have found a lot of information on it, but don’t have enough understanding of php to get it. So can someone explain it to me in layman’s terms?
What I have so far (which I suspect is quite wrong) >>
<?php include('db_login.php');
//Connect to database - Begin
$connection = mysql_connect( $db_host, $db_username, $db_password );
if (!$connection) {
die ("Could not connect to the database: <br />". mysql_error());
}
$db_select=mysql_select_db($db_database);
if (!$db_select)
{
die ("Could not select the database: <br />". mysql_error());
}
$query = "Select Merch_Desc Merchandise";
$result = mysql_query( $query );
if (!$result)
{
die ("Could not query the database : ". mysql_error());
}
While ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$Desc= $row["Merch_Desc"];
}
$Counter=0
?>
<HTML>
<BODY>
<table>
<tr>
<td>Column 1</td><td>Column 2</td><td>Column 3</td><td>Column 4</td>
<tr>
<td><?=$Desc?></td>
<? if ($Counter=5)
{
$Counter=0"</tr>";
}
?>
</table>
Any help would be great(And if you happen see anything else in the code that can be improved on i would appreciate that too.)
MOD EDIT: Added code tags