php - How to show all users, including IP, rank and other variables? -


i starting php/sql-programmer, making dashboard learning , have question. want let page show this:

id name     ip            rank
1   willem   127.0.0.1 5
2   you       127.0.0.1 3

<table style="width:100%;color:white;">           <tr>             <th><center>id</center></th><th>naam:</th><th>ip:</th><th><center>actie</center></th>           </tr> <?php            $d = $con->query("select * tbl_users order id desc limit 1000");           while($r = $d->fetch_object()){            ?>           <tr>             <td style="width:35px;text-align:center;"><?php echo $r->id; ?></td>             <td><?php echo $r->username; ?></td>             <td><font color="red">geblokkeerd</font></td>             <td style="width:50px;text-align:center"><a href="./ase_users?type=edit&id=<?php echo $r->id; ?>">bewerk</a></td>           </tr>           <?php } ?>         </table 

but if put code in de page, gives me following error:

notice: undefined variable: conn in /home/xxxxxxx/domains/xxxxxxx.nl/public_html/dashboard/beheer.php on line 133  fatal error: call member function query() on null in /home/xxxxxxxx/domains/xxxxxx.nl/public_html/dashboard/beheer.php on line 133 

the dbconfig

 dbconfig.php     <?php     class database     {          private $host = "localhost";         private $db_name = "xxxxxx";         private $username = "xxxxxx";         private $password = "xxxxxx!";         public $conn;          public function dbconnection()         {              $this->conn = null;                 try             {                 $this->conn = new pdo("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password);                 $this->conn->setattribute(pdo::attr_errmode, pdo::errmode_exception);                }             catch(pdoexception $exception)             {                 echo "connection error: " . $exception->getmessage();             }              return $this->conn;         }     }     ?> 

does knows how fix this?


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -