Hi All,

I have an issues with a mysqli procedure.

I am running PHP 5 with mysql server 5 and when I run the script below I get an error "Class 'mysqli' not found"

Do I need to update my PHP ini? and / or add a library? or something else?

(please note, when viewing the code below, for my own understanding of how classes work I have de-constructed some classes and pieced together the script you see. One I understand fully what is going on, I will put the classes back together so the functionality can be used as it was designed)

Many thanks.

<?
session_start();
if(empty($_POST['username']) && empty($_POST['password'])) {
}else {

define ('MY_SERVER', 'localhost');
define ('MY_USER', 'myuser');
define ('MY_PASSWORD', 'mypassword');
define ('MY_DB', 'mydb');

$conn = new mysqli(MY_SERVER, MY_USER, MY_PASSWORD, MY_DB) 
			or die ('There was a problem connecting to the database');	
							
$query = "SELECT *FROM user_table WHERE username = ? AND password = ?";		
		
if ($stmt = $conn->prepare($query)){
			$stmt->bind_param('ss', $_POST['username'], $_POST['password']);
			$stmt->execute();
?>

Check your php.ini file to see if it is enabled, you can find how here: http://www.daniweb.com/forums/thread41405.html

I have enabled the mysqli extension (using change from add/remove programs in control panel was easy) and all seems to be fixed.

Many thanks for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.