Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]PDO funkcja nie pokazuje się, kod początkującego
Wertas
post
Post #1





Grupa: Zarejestrowani
Postów: 45
Pomógł: 0
Dołączył: 2.03.2010

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


  1. class AuctionHouse
  2. {
  3. var $maxLength,
  4. $connection;
  5. private $db_host;
  6. private $db_user;
  7. private $db_password;
  8. private $db_name;
  9. private $lim;
  10. private $template;
  11.  
  12.  
  13. /**
  14. * Constructor, executed when we make a new object.
  15. *
  16. * @return Object
  17. */
  18. function _construct() {}
  19.  
  20. function AuctionHouse()
  21. {
  22.  
  23. $this->db_host='localhost';
  24. $this->db_user='root';
  25. $this->db_password='';
  26. $this->db_name='d3';
  27. $this->lim='20';
  28. $this->template = 'templates/DisplayTemplate.php';
  29. $this->trclass= '';
  30. }
  31. function editItem($id)
  32. {
  33. $id = $_GET['id'];
  34. if(is_numeric($id))
  35. {
  36. $this->connect();
  37.  
  38. $result = mysql_query("SELECT * FROM items WHERE id='$id'");
  39. while($row = mysql_fetch_array($result))
  40. {
  41. $datadump = '';
  42.  
  43. foreach($health as $klucz => $nazwa)
  44. {
  45. if(isset($row[$klucz]) && $row[$klucz] != 0)
  46. {
  47. $datadump .= '<tr class="'.$trclass.'"><td>' . $nazwa . '</td><td><input type="text" name="'.$klucz.'" value="' . $row[$klucz] . '"/></td></tr>';
  48. }
  49. }
  50. }
  51. echo $datadump;
  52.  
  53. require($this->template); // Show item with our template.
  54.  
  55. $this->close();
  56. return true;
  57. }
  58. else return false; // Not valid number
  59.  
  60. }


Pobieram jako

  1. require('../AuctionHouse.php');
  2. $ah = new AuctionHouse();
  3. $ah->editItem(4);
  4.  



Błąd to Fatal error: Call to a member function editItem() on a non-object in C:\xampp\htdocs\tip\tooltip\cms\admin\editItemForm.php on line 47


Gdzie jest błąd?

Ten post edytował Wertas 17.07.2012, 16:45:09
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 3.10.2025 - 19:00