title: Looking for help to make a select statement dynamic
body: <p>I want to make a dynamic select statement that can select whatever table I ask for, same with table columns in my database.</p>
  <p><strong>Here is my select class so far:</strong></p>
  <pre><code>&lt;?php
  
     class select extends database{
      // Instance variables
      private $id;
      public $table;
      public $column;
      public $sql;
      public $result = array();
  
      // Methods - Behavior
      public function selectQuery($table){
          
          global $con;
          
          $sql = $this-&gt;sql;
          
          $sql = &quot;SELECT * FROM {$table}&quot;;
          
          $result = $this-&gt;con-&gt;query($sql);
          
          while($row = $result-&gt;fetch_object()){
              //iterate all columns from the selected table 
              //and return it someway.
          }
      }
  }
  $selectQuery = new select();
  </code></pre>
  <p><strong>Here is my database class</strong></p>
  <pre><code>require_once(LIB_PATH.DS.&quot;config.php&quot;);
  class database
  {
      public $con;
      public $result = array();
  
      public function __construct()
      {
          $this-&gt;con = new mysqli(DB_HOST,DB_USERNAME,DB_PASSWORD,DB);
          if($this-&gt;con-&gt;connect_error){
              die($this-&gt;con-&gt;connect_error);
          }
      }
  }
  $db = new database();
  </code></pre>
  <p>What I'm doing so far is connecting to my Database with mysqli then I extend my select class from my database class so I can get the connection and then I want to select all from.</p>