Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost";
- $username = "root";
- $password = "";
- $obj=mysqli_connect($host,$username,$password,'class');
- /*if($obj)
- echo "Success<BR>";
- else
- echo"No Sucess<BR>";
- */
- $st='SELECT StudentID,SFirstname,SLastname FROM student';
- $result=mysqli_query($obj,$st);
- if(!$result)
- {
- echo mysqli_error().'<BR>';
- die('can not');
- }
- else
- {
- echo'<table border="1">';
- echo '<tr>';
- echo '<td>';
- echo "StudentID";
- echo '</td>';
- /*echo '<td>';
- echo"Firstname";
- echo '</td>';
- echo '<td>';
- echo "Lastname";
- echo '</td>';*/
- echo '</tr>';
- echo '<br>';
- while($row=mysqli_fetch_array($result,MYSQLI_NUM))
- {
- echo '<tr>';
- echo'<td>'.$row[0].'</td>';
- /*echo'<td>'.$row[1].'</td>';
- echo'<td>'.$row[2].'</td>';*/
- echo '</tr>';
- }
- /*while($row=mysqli_fetch_assoc($result))
- {
- echo '<tr>';
- while(list($key,$value)=each($row))
- {
- if($value=='')
- echo '<td>'.' '.'</td>';
- else
- echo '<td>'.$value.'</td>';
- }
- echo '</tr>';
- }*/
- /*while($row=mysqli_fetch_assoc($result))
- {
- echo '<tr>';
- echo '<td>'.$row['StudentID'].'</td>';
- echo '<td>'.$row['SFirstname'].'</td>';
- echo '<td>'.$row['SLastname'].'</td>';
- echo '</tr>';
- }*/
- mysqli_close($obj);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement