ermucis Posted June 2, 2004 Report Share Posted June 2, 2004 Kā lai uzraksta, lai man tiktu izvadiita tabulas visi tabulaa esoshie dati!? Piedodiet, esmu iesaaceejs! Mees visi kaut kad taadi esam.. :P paldies jau ieprieksh! :D Link to comment Share on other sites More sharing options...
ermucis Posted June 2, 2004 Author Report Share Posted June 2, 2004 bija domaats izvadiit tabulas veidaa Link to comment Share on other sites More sharing options...
рпр Posted June 2, 2004 Report Share Posted June 2, 2004 ja tu domaa html tabulaa izvadiit sql tabulu, tad tas jaadara apmeeram shaadi select * from tabula; while($masiivs = mysql_fetch_array($sql_rezultaats)) { print_r($masiivs ); } par noformeejumu padomaa pats Link to comment Share on other sites More sharing options...
ermucis Posted June 3, 2004 Author Report Share Posted June 3, 2004 Pievienoshu labu un vienkaarsu tabulas izvadi tabulaa! Tas visiem, kas saak ar PHP .. ;) <?php $db = mysql_connect("localhost", "", ""); mysql_select_db("support",$db); $result = mysql_query("SELECT * FROM products",$db); echo "<table border=1>\n"; echo "<tr><td>Class</td><td>Product number</td><td>Hardware</td><td>Warranty</td><td>Warranty tipe</td><td>Service level</td><td>Year</td><td>Priece</TD></tr>\n"; while ($myrow = mysql_fetch_row($result)) { printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $myrow[0], $myrow[1], $myrow[2], $myrow[3], $myrow[4], $myrow[5], $myrow[6], $myrow[7]); } echo "</table>\n"; ?> Link to comment Share on other sites More sharing options...
Venom Posted June 7, 2004 Report Share Posted June 7, 2004 Es gan kaut kā universālāk (jebkuram pieprasījumam): <?php ... $result = mysql_query("SELECT * FROM products"); echo '<table><tr>'; $fields=@mysql_num_fields($result); $column=-1; //izvadām kolonnu nosaukumus kā header rūtiņas while(++$column<$fields) echo '<th>'.@mysql_field_name($result,$column).'</th>'; @mysql_data_seek($result,0); echo "</tr>\n"; //ar vienu rāvienu izvadām atgriestos datus while($data=mysql_fetch_assoc($result)) echo '<tr><td>'.join('</td><td>',$data)."</td></tr>\n"; echo '</table>'; flush();//šis lai ātrāk tabula izvadās ?> Link to comment Share on other sites More sharing options...
Recommended Posts