I'm having a connection errors trying to connect with PHP to mySQL. I'm using a video instructable, because I've been having several of these connections before, but it is outdated and I'm trying to use mysqli instead of mysql commands, but I'm winding up with nothing posting on my pages, I think because of this. Can you tell me if this would be the correct translation of it?
function user_exists($username) {
$username = sanitize($username);
$query = mysqli_query("SELECT COUNT('user_id') FROM 'users' WHERE 'username' = '$username'");
Sanitize is defined on another page (and included) as:
<?php
function sanitize ($data) {
return mysqli_real_escape_string($data);
}
?>
Please help!