Hi, I have read that using mysqli is much better than normal mysql so I have decided to convert all of the mysql stuff to mysqli stuff in a very new project.
I am new to OOP altogether so I am stuck.
Currently I have a function for checking if something exists in a database:
function detail_available($table,$detail,$value){
/* Function for checking dupes. */
$query = "SELECT * FROM $table WHERE $detail = '$value'";
$result = mysql_query($query);
$information = mysql_fetch_assoc($result);
if(!$information){
return true;
}else{
return false;
}
}
and I have tried changing it to this:
function detail_available($table,$detail,$value){
/* Function for checking dupes. */
$available = $mysqli->query("SELECT * FROM $table WHERE $detail = '$value'");
$count = $available->num_rows;
if($count==0){
return true;
}else{
return false;
}
}
I am getting errors saying $mysqli is an undefined variable etc etc, is there a way to use the current $mysqli object inside functions that I create? ive searched around on google etc and found nothing. Thanks in advance
BTW the full script that I am editing now is on this forum: