Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $mysqli=new mysqli("localhost","root","mysqlpassword","MarcTextOldBib");
- if (mysqli_connect_errno()) {echo "Failed to connect to MySQL: " . mysqli_connect_error();}
- $db_abfrage = "SELECT `cid` , `field_data` FROM T1xx";
- $j=0;
- $db_ausgabe = $mysqli->query($db_abfrage);
- while($row = $db_ausgabe->fetch_object()){
- $names[$j] = array( "cid" => $row->cid,
- "field_data" => $row->field_data,
- );
- $j++;
- }
- $mysqli->close();
- echo"
- <table border='1'>
- <thead><tr>
- <th>ID</th> <th>Name</th>
- </tr></thead>";
- //3203
- $ID=1;
- for ( $i = 0; $i <= 20; $i++ ){
- $cid = $names[$i][cid];
- echo "<tr>";
- if( ($ID) == $names[$i][cid] ){
- echo "<td>".($ID)."</td>";
- echo "<td>". $names[$i][field_data] ."</td>";
- echo "</tr>";
- $ID++;
- } else {
- while( $ID != $names[$i][cid] ){
- echo "<td>".($ID)."</td>";
- echo "<td></td>";
- echo "</tr>";
- ++$ID;
- }
- $i--;
- }
- }
- for ( $i = 20; $i <= 40; $i++ ){
- $cid = $names[$i][cid];
- echo "<tr>";
- if( ($ID) == $names[$i][cid] ){
- echo "<td>".($ID)."</td>";
- echo "<td>". $names[$i][field_data] ."</td>";
- echo "</tr>";
- $ID++;
- } else {
- while( $ID != $names[$i][cid] ){
- echo "<td>".($ID)."</td>";
- echo "<td></td>";
- echo "</tr>";
- ++$ID;
- }
- $i--;
- }
- }
- echo "</table>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement