0

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();
?>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Thorby68
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.