بروز خطا
[message]
اشتراک در سوال
رای ها
[dataList]
Class 'Db' not found
با سلام من دارم کدهای استاد را اجرا میکنم ولی با خطای بالا مواجهه میشوم حتی پروژه 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();
}
}
0
0
بعد از جستجوهای فراوان (7 سال پیش)
برای این سوال پاسخی وجود ندارد.
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .