I try to write my database driver of the mysql type, I want the result of the query to be recorded as $data['user_name'] in $data['user_name'] . array, a lot of ideas, I want to hear the opinions of experts:

  public static function select($query) { mysql_query($query) or die($logs->write(mysql_error())); } 

cause so

  if(isset(parent::$id)) { $data['user_name'] = mysql :: select("SELECT `login` FROM `user` WHERE `id` = '". parent::$id ."'"); } 

Thanks for answers!

    1 answer 1

    I am not an expert, of course, but I think many will agree with this.

     public static function select() { $result = mysql_query($query) or die($logs->write(mysql_error())); if ( !mysql_num_rows($result) ) { return false; } while($row = mysql_fetch_assoc($result)) { $rows[] = $row; } return $rows; } 
    • what I wanted, thanks - johniek_comp