Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class dbtable
- {
- function __construct()
- {
- //$this->dbhost = 'localhost';
- //$this->dbuser = 'root';
- //$this->dbname = 'iams';
- //$this->dbpass = '';
- //$this->dbusertable = 'users';
- //session_start();
- }
- function passresult($result)
- {
- $this->result=$result;
- $this->numofrow=mysql_num_rows($this->result);
- $this->numofcol=mysql_num_fields($this->result);
- }
- function htmltable()
- {
- if (($this->numofrow)>0)
- {
- echo '<table border=1>';
- echo '<tr>';
- for ($i = 0; $i < $this->numofcol; $i++)
- {
- echo '<th>'.mysql_field_name($this->result, $i).'</th>';
- }
- echo '</tr>';
- while($row=mysql_fetch_array($this->result))
- //for($j=0; $j<($this->numofrow); $j++)
- { var_dump($row);
- echo '<tr>';
- for($i=0; $i<($this->numofcol); $i++)
- {
- echo '<td>'.$row[$i].'</td>';
- }
- echo '</tr>';
- }
- echo '</table>';
- }
- else {echo "No Data is there in supplied argument";}
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement