hbjælp med at finden fejlen
appheadif (!empty($_GET) ){
if (!empty($_GET['p'])){
$post =$_GET['p'];
}
if (!empty($_GET['News'])){
$News = $_GET['News'];
}
}
if (empty($post) && empty($News)) {
print_r $query->All_Post_News());
} elseif (!empty($post)) {
Echo'Test';
} else (!empty($News)&& empty($post)) {
if (!empty($News))
{
echo 'Nyheder';
}
>>class-db
if (!class_exists('DB')) {
class DB {
public function __construct() {
$mysqli = new mysqli('localhost', 'user, 'pass', 'db');
if ($mysqli->connect_errno) {
print('error connect db');
exit();
}
$this->connection = $mysqli;
}
public function insert($query) {
$result = $this->connect->query($query);
return $result;
}
public function select($query) {
$result = $this->connection->query($query);
while ($obj = $result->mysqli_fetch_object()) {
$returns[] = $obj;
}
return $results;
}
}
}
$db = new DB;
>> class-query(side)
require_once 'class-Db.php';
if (!class_exists('QUERY')) {
class QUERY {
public function All_Post_News($query) {
global $db;
$query = "
SELECT * FROM pages
";
return $db->select();
}
public function Fontepage($query) {
global $db;
$query = "
SELECT * FROM pages
where ID='1'
";
return $db->select();
}
}
}
$query = new QUERY;
Fejlen er pt
Warning: Missing argument 1 for QUERY::All_Post_News(), called in /home/www/public_html/Datacms/include/AppHead.php on line 20 and defined in /home/www/public_html/Datacms/include/class-query.php on line 13
Warning: Missing argument 1 for DB::select(), called in /home/www/public_html/Datacms/include/class-query.php on line 20 and defined in /home/www/public_html/Datacms/include/class-Db.php on line 28
Notice: Undefined variable: query in /home/www/public_html/Datacms/include/class-Db.php on line 29
Warning: mysqli::query(): Empty query in /home/www/public_html/Datacms/include/class-Db.php on line 29
Fatal error: Call to a member function mysqli_fetch_object() on a non-object in /home/www/public_html/Datacms/include/class-Db.php on line 31