Almost finished my login script, just need a helping hand in finding a substitute method for this:
return (mysql_result($query, 0) == 1) ? true : false;
The query:
$query = mysqli_query($link, "SELECT COUNT 'id' FROM 'user_login_details' WHERE 'username' = '$username' AND 'password' = '$password'");
This query is designed to search for the user's id that is attributed to the $password and $username that the user entered.
The ternary operator statement basically says, "return" "true" if the "id" of the record that the user's username and password is "==1". Basically making sure that the record exists and the details are actually present on the database by using the 2nd parameter of mysql_result to check the row number. It's my first record so the number will be 0.
$link
I have found that as of mysqli, the database link connection is require with every query now (a bit weird as it over complicates things) but the primary issue is that mysqli_result doesn't exist and so somehow I need to find an inbuilt function (or build one myself) that can check the row number for the query result (id) and check if it equals one.
I essentially want to be able to write this:
return (mysqli_result($query, 0) == 1) ? true : false;
Any help would be great thanks,
Tom