Jump to content

ppicasso772

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by ppicasso772

  1. it will be a basic e-commerce site
  2. i did everythink but when i clich to categories it is not working . Why ? main.php header.php sidebar.php products.php category.php
  3. would you fix and send me on which file has problem ?
  4. on which file ? topic.php ??
  5. ... topic.php topics.php topic.php
  6. how can i send a video . it will explain better
  7. than it says Fatal error: Call to undefined method Topic::getByCategory() in C:\xampp\htdocs\talkingspace\topics.php on line 15 i m thinking i have to write sth after $this->db->query("SELECT topics.*, categories.*, users.username, users.avatar,......here.... but i dont know what will i write .
  8. ERROR  Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN categories ON topics.category_id = categories.id INNER ' at line 2' in C:\xampp\htdocs\talkingspace\libraries\Database.php:60 Stack trace: #0 C:\xampp\htdocs\talkingspace\libraries\Database.php(60): PDOStatement->execute() #1 C:\xampp\htdocs\talkingspace\libraries\Database.php(64): Database->execute() #2 C:\xampp\htdocs\talkingspace\libraries\Topic.php(44): Database->resultset() #3 C:\xampp\htdocs\talkingspace\topics.php(15): Topic->getByCategory('2') #4 {main} thrown in C:\xampp\htdocs\talkingspace\libraries\Database.php on line 60 Database.php Topic.php
  9. <?php class Database{ private $host = DB_HOST; private $user = DB_USER; private $pass = DB_PASS; private $dbname = DB_NAME; private $dbh; private $error; private $stmt; public function __construct(){ // Set DSN $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->dbname; // Set options $options = array( PDO::ATTR_PERSISTENT => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ); // Create a new PDO instanace try{ $this->dbh = new PDO($dsn, $this->user, $this->pass, $options); } // Catch any errors catch(PDOException $e){ $this->error = $e->getMessage(); } } } public function query($query){ $this->stmt = $this->dbh->prepare($query); } public function bind($param, $value, $type = null){ if (is_null($type)) { switch (true) { case is_int($value): $type = PDO::PARAM_INT; break; case is_bool($value): $type = PDO::PARAM_BOOL; break; case is_null($value): $type = PDO::PARAM_NULL; break; default: $type = PDO::PARAM_STR; } } $this->stmt->bindValue ( $param, $value, $type); } public function execute(){ return $this->stmt->execute(); } public function resultset(){ $this->execute(); return $this->stmt->fetchAll(PDO::FETCH_OBJ); } public function single(){ $this->execute(); return $this->stmt->fetch(PDO::FETCH_OBJ); } public function rowCount(){ return $this->stmt->rowCount(); } public function lastInsertId(){ return $this->dbh->lastInsertId(); } public function beginTransaction(){ return $this->dbh->beginTransaction(); } public function endTransaction(){ return $this->dbh->commit(); } public function cancelTransaction(){ return $this->dbh->rollBack(); } what is problem here i could not fix it .line 32 with red color
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.