Prepared statements

Post here if you need help with SQL.
Post Reply
Posts: 2
Joined: Thu Aug 09, 2012 6:41 am

Prepared statements

Post by Wizzurizz »

Hello all,

I Just re-joined this forum after time travel without my lap Big mistake!...

Now I'm back to working on my skills in writting code and I have a problem with some Prepared statements i'm trying to use..

function AddUser($user, $pass){
//$user = mysql_real_escape_string(htmlentities($user));
//$pass = sha1($pass);

$mysql = new mysqli('localhost', 'user', 'pass', 'dbname') or die('Could not Connect to Databse');

$stmt = $mysql->prepare("INSERT INTO `users` (`user_username`, `user_password`) VALUES (:username, :password)") or die('There is a problem with the query.');
$stmt->bindparam(':username', $user);
$stmt->bindparam(':password', $pass);


I can't get this query to work, and to me it looks just like the one on

If you know something about prepared startements please show me the way ;)

Best regards
User avatar
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK

Re: Prepared statements

Post by jacek »

Welcome back :D

Your mixing PDO and mysqli, try this example
Post Reply