Jump to content

help error


Danny620

Recommended Posts

<?php

class Northplanet_CMS {

var $host = 'localhost';
var $username = 'root';
var $password = '*****';
var $table = '*****';


function connect() {

$conn = mysqli_connect($this->host, $this->username, $this->password, $this->table) or die("Could not connect. " . mysql_error());
    return $conn;

}

function update($element_id, $conn) {

if(is_numeric($element_id)){

//query to db

$q = "SELECT * FROM page_elements WHERE element_id = $element_id";
    $r = mysqli_query($conn, $q);

echo $r[text];


}else{

$error = 'Invalid Element';
return $error;

}

}

}

$Northplanet = new Northplanet_CMS();

$Northplanet->connect();
$update = $Northplanet->update('1',$conn);
echo $update;

?>

 

i get an

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\class.php on line 24

Link to comment
https://forums.phpfreaks.com/topic/194800-help-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.