Dear visitor, welcome to Coder Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
Wie realisiere ich, das PHP mir automatisch Zeilen ergänzt
Kein Problem. Wenn du jetzt noch Probleme hast, dann poste ein paar Code-Teile. Ohne macht es wenig Sinn, dir zu helfen.
Das gilt übrigens generell bei jedem Problem, nicht nur hier.
|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<?php include 'config.inc.php'; include 'db_conn_s.php'; $result = mysql_query("SELECT * FROM voting_g"); echo "<table border='1'> <tr> <th>ID</th> <th>Name</th> <th>Punkte</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ID'] . "</td>"; echo "<td>" . $row['Vorname'] . "</td>"; echo "<td>" . $row['Punkte'] . "</td>"; echo "</tr>"; } echo "</table>"; include 'db_conn_c.php'; ?> |
|
|
PHP Quellcode |
1 2 3 4 5 |
$i = 0; while(xyz) { echo ($i % 2 == 0) ? 'Klasse1' : 'Klasse2'; $i++; } |
PHP Funktion wie Smarty Funktion cycle?
Alternativ auch so:
![]()
PHP Quellcode
1 2 3 4 5 $i = 0; while(xyz) { echo ($i % 2 == 0) ? 'Klasse1' : 'Klasse2'; $i++; }
|
|
PHP Quellcode |
1 |
echo ($i % 2 == 0) ? 'Klasse1' : 'Klasse2'; |
This post has been edited 9 times, last edit by "Kev95" (Dec 18th 2010, 1:45pm)

|
|
PHP Quellcode |
1 |
echo "<tr class=\"".(($i % 2 == 0) ? "tr_1" : "tr_2")."\">"; |