بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]
پرسش و پاسخ

Class 'Db' not found

مدیریت گفتگو
Fax_Modem 7 سال پیش
آخرین تغییر: 7 سال پیش

با سلام من دارم کدهای استاد را اجرا میکنم ولی با خطای بالا مواجهه میشوم حتی پروژه notes را هم دانلود کردم اجرا میکنم باز همین خطا را میده؟؟ از php 7.2.10 دارم استفاده میکنم!

 
 
<html>
<body>
<?php
require_once ('common.php');
require_once ('config.php');
require_once ('db.php');
$db= new Db();
$records = $db->query("SELECT * FROM x_note LEFT OUTER JOIN x_user ON x_note.user_id=x_user.user_id");
dump($records);
?>
</body>
</html>
 
 
 
<?
class Db {
private $connection;

public function __construct($option = null){
if ($option != null){
$host = $option['host'];
$user = $option['user'];
$pass = $option['pass'];
$name = $option['name'];
} else {
global $config;
$host = $config['db']['host'];
$user = $config['db']['user'];
$pass = $config['db']['pass'];
$name = $config['db']['name'];
}

$this->connection = new mysqli($host, $user, $pass, $name);
if ($this->connection->connect_error) {
echo "Connection failed: " . $this->connection->connect_error;
exit;
}

$this->connection->query("SET NAMES 'utf8'");
}

public function first($sql){
$records = $this->query($sql);
if ($records == null){
return null;
}

return $records[0];
}

public function insert($sql){
$id = $this->connection->query($sql);
return $id;
}

public function query($sql){
$result = $this->connection->query($sql);
$records = array();

if ($result->num_rows == 0) {
return null;
}

while($row = $result->fetch_assoc()) {
$records[] = $row;
}

return $records;
}

public function connection(){
return $this->connection;
}

public function close(){
$this->connection->close();
}
}
 

نظرات

Fax_Modem 7 سال پیش
بعد از جستجوهای فراوان

هنوز پاسخی ثبت نشده است


پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .