Warning: Mysql_result() Expects Parameter 1 To Be Resource, Object Given
How to solve this error using wampserver, Warning: mysql_result() expects parameter 1 to be resource, object given
There is no direct equivalent to mysql_result() in mysqli, but you can use the function mysqli_result implemented in the below code. This function emulates what mysql_result() does but for the mysqli extension.
Change your code to this:
<?php
session_start();
?><html><linkhref="my_layout.css"type="text/css" /><title>Phone Book Project</title><bodyclass="my_body"><divid="my_divition"><?phpfunctionmysqli_result($result , $offset , $field = 0){
$result->data_seek($offset);
$row = $result->fetch_array();
return$row[$field];
}
$connect=mysqli_connect("localhost","root","","phonebook");
$username=$_POST['username'];
$password=$_POST['password'];
$sql="select * from members where username='$username' AND password='$password'";
if($result=mysqli_query($connect,$sql)){
$number=mysqli_num_rows($result);
}
if($number>0)
{
$id=mysqli_result($result,0,"id");
$_SESSION['id']=$id;
session_register('id');
include('Control.php');
}
elseecho"<h1> <br /><br />Sorry : invalid entery <br /><br /></h1><a href=index.php >
go back </a>";
?>
Post a Comment for "Warning: Mysql_result() Expects Parameter 1 To Be Resource, Object Given"