I have changed php from 5.2 to 5.3 and accordingly I changed the following code from mysql to mysqli. But it is not working but in 5.2 with mysql it is working fine. Any help in this regard will be appreciated.
<?php
$request = trim(strtolower($_REQUEST['username']));
$query = "SELECT username FROM advt WHERE username =
'$username'";
$result = mysqli_query($query) or die(mysqli_error());
$valid = 'true';
if (mysqli_num_rows($result) != 0)
$valid= '"The email is already in use, please choose another"';
{
echo $valid;
}
?>
When you use procedural style, you need to pass in the database link. For example:
$result = mysqli_query($link, $query);
See the docs for mysqli_
$connection = mysqli_connect($host, $username, $password, $db);
mysqli_query($connection, $sql);
This is the right method of using mysqli_query function.
If you are creating double connection to mysql from php, one for mysql and another for mysqli then comment out the mysql connect code or use mysql database select link with your mysqli queries.