Als Fred -ii- zegt dat je mysql niet met mysqli moet mixen
Er is geen direct equivalent van mysql_result() in mysqli, maar u kunt de functie mysqli_result gebruiken die in de onderstaande code is geïmplementeerd. Deze functie emuleert wat mysql_result() doet, behalve voor de mysqli-extensie.
Verander je code in dit:
<?php
session_start();
?>
<html>
<link href="my_layout.css" type="text/css" />
<title>Phone Book Project</title>
<body class="my_body">
<div id="my_divition">
<?php
function mysqli_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');
}
else
echo"<h1> <br /><br />Sorry : invalid entery <br /><br /></h1><a href=index.php >
go back </a>";
?>