I have a PHP file that I extract data from the database, the data I want to defend as a table, but the problem is that I only appear in the line. If someone can tell me where I wrong? <html> <body> <tabel> <? $link = mysql_connect($server, $user, $password) or die("Nu se poate conecta"); mysql_select_db($database, $link) or die("nu se poate alege baza de date"); $query = "select * from fotbal where country like '%".mysql_real_escape_string($tara)."%' and state < 3"; $result = mysql_query($query) or die("Query failed"); $rezult = array(); while ($myrow = mysql_fetch_array($result)) { echo "\n<tr>"; echo "\n<td>".$myrow["competition"].":</td>"; echo "\n<td>".$myrow["club1"]."<b> ".$myrow["score1"]."-".$myrow["score2"]."</b> ".$myrow["club2"]."</td>"; echo "\n<td>".$myrow["info1"]." ".$myrow["info2"]."</td>"; echo "\n</tr>"; } mysql_close($link); ?> </tabel> </body> </html> Thank you in advance. Would be one thing: how to color these rows? Best regards, george
Hi bartolay13, Thanks very much, now is work. I am very tired and I saw no mistake. Thanks again, george
A few tips/solutions : table not tabel \n - remove them all $var["value"] - replace double-quotes with single-quotes
Shouldn't have any impact on anything, and they make it easier to debug the HTML code. Microscopically faster to evaluate but shouldn't have any real impact.
if ($i++ % 2 == 1) $color="#f0f0f0"; else $color="#0f0f0f"; echo "\n<td bgcolor=\"$color\">".$myrow["competition"].":</td>"; echo "\n<td>".$myrow["club1"]."<b> ".$myrow["score1"]."-".$myrow["score2"]."</b> ".$myrow["club2"]."</td>"; echo "\n<td>".$myrow["info1"]." ".$myrow["info2"]."</td>"; Code (markup):