PF2G Posted October 24, 2011 Share Posted October 24, 2011 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. <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. Thank You Quote Link to comment https://forums.phpfreaks.com/topic/249719-table-with-connection-mysql-database/ Share on other sites More sharing options...
Nodral Posted October 24, 2011 Share Posted October 24, 2011 NEVER EVER EVER EVER give out your DB username and Password on an open forum. You are practically inviting hackers and other malicious types to destroy your site!!! Quote Link to comment https://forums.phpfreaks.com/topic/249719-table-with-connection-mysql-database/#findComment-1281801 Share on other sites More sharing options...
PF2G Posted October 25, 2011 Author Share Posted October 25, 2011 Any Help Please Quote Link to comment https://forums.phpfreaks.com/topic/249719-table-with-connection-mysql-database/#findComment-1282100 Share on other sites More sharing options...
PF2G Posted October 26, 2011 Author Share Posted October 26, 2011 People, Com'n I need this ASAP. PLEASE Thank you Quote Link to comment https://forums.phpfreaks.com/topic/249719-table-with-connection-mysql-database/#findComment-1282311 Share on other sites More sharing options...
voip03 Posted October 26, 2011 Share Posted October 26, 2011 <?php $s = "SELECT nome_curso, imagem_curso FROM cursos ORDER BY nome_curso"; $r = mysql_query($s); $n = mysql_num_rows($r); if($n !=0) { echo"<table width='750' border='1' cellspacing='0' cellpadding='1'><tr>"; while($row = mysql_fetch_assoc($r)) { echo "<td>". $row['nome_curso']."</td>"; echo "<td><img src='imagepath/images/". $row['imagem_curso'] ." ></td>"; } echo "</tr></table>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/249719-table-with-connection-mysql-database/#findComment-1282317 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.