<?php class db{ function __construct(){} public function db_connect(){ include("./libs/config.php"); return $this->connect; } public function execute_query($_question){ $this->question = $_question; } public function show_query(){ return $this->question; } public function count_rows($_question){ $this->question = $this->execute_query($_question); } public function db_select($_question){ $i=0; $query = $this->execute_query($_question); foreach($row as $fieldName => $fieldValue){ $dataArray[$i][$fieldName] = $fieldValue; } $i++; } return $dataArray; } public function db_close() { } } ?>
Do funkcji execute_query() chciałem dopisać jakiś error handler informujący mnie o błędach w kodzie sql.
probowalem w taki sposob:
<?php public function execute_query($_question){ $this->question = $_question; return 0; } else } ?>
ale wtedy kod sql ktory jest poprawny (np inserty do bazy) wykonywany jest dwa razy...
Bardzo prosze o jakies sugestie...