Create Table PHP with connection MySQL DB

Started by PF2G, October 25, 2011, 06:01:56 PM

PF2G

Hello, PHPFreaks

I'm creating a website about a Music School and i want to create a table with the instruments one row with image and a row bellow with their name.

Code:

<table width="200" height="134">
<?PHP

//connect database
$dbhost = "";
$db = "";
$dbuser = "";
$dbpass = "";
$connect = mysql_connect($dbhost,$dbuser,$dbpass) or die ("Falha ao ligar à Base de Bados: " . mysql_error());

//3 columns limit
i == 3;
while {
i == i + 1;
if i == 1 {
?>
<tr>
<td>

<?PHP 
}  else 
{
?>
<td>

<?   
}
$sql = "SELECT nome_curso, imagem_curso FROM cursos ORDER BY nome_curso";
}
if i == 3 {
?>
</td>
</tr>

<?
}else
{
?>
</td>

<?PHP
}?>
</table>



The name and the image are in a MySQL DB.

Please help me.