Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Problem z zapytaniem SQL (Class)
moto0095
post 21.12.2010, 14:30:06
Post #1





Grupa: Zarejestrowani
Postów: 247
Pomógł: 9
Dołączył: 12.03.2010

Ostrzeżenie: (0%)
-----


Witam.
Ostatnio zrobiłem sobie taką klasę do pobierania materiałów z bazy i mam problem z "podawaniem" zapytania:
  1. class GetMedia {
  2. protected $array = array();
  3. public $sql;
  4.  
  5. public function GetMedia($sql) {
  6. $this->sql = $sql;
  7. }
  8.  
  9. function __construct() {
  10. global $db;
  11. $res = $db->query($this->sql); // tu mi się wyświetli prośbę o podanie zapytania.
  12. while($row = $res->fetch_array()) {
  13. $this->array[] = $row;
  14. }
  15. }
  16.  
  17. public function Draw(){
  18. return $this->array;
  19. }
  20. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 26.06.2025 - 14:52