Hi,
On the below script I get this error
Warning mysql_result() expects parameter 1 to be resource, object given in data.php on line 33
On another page there is a text box and button,when button is pressed the below file checks if there's a value in the text box, if it's in the database and if it is in the database it displays the results. The below case results being the name and age.
In the below I tried to change the MSQL to MSQLI as much as I could except I'm stuck with line 33 which contains
$age = mysql_result($age, 0);
Any help with this would be much appreciated. Thanks
This is the Data.php that the error is contained
<?php
$db = new mysqli('localhost','user','pass,'testing');
if($db->connect_errno) {
//echo $db->connect_error;
die('<br>Oops! we are having some problems, this is currently being fixed.');
}
$name = mysqli_real_escape_string($db,$_POST['name']);
if($name==NULL)
echo "Please enter a name!";
else
{
$age = mysqli_query($db,"SELECT age FROM rates.People2 WHERE name='$name'");
$age_num_rows = mysqli_num_rows($age);
if($age_num_rows==0)
echo "Name does not exists!";
else
{
$age = mysql_result($age, 0);
echo "$name's age is $age";
}
}
?>