0

Seem to be having a problem. As line 52 if (mysqli_num_rows{$search_Result}) is giving me the Parse error: syntax error, unexpected.

<?php

$host = "localhost";
$user = "root";
$password = "";
$database ="zebase";
$id="";
$name="";
$address="";
$actnum="";
$status="";
$remarks="";

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
function getPosts()
{

$Post =  array();
$POST[0]= $_POST['id'];
$POST[1]= $_POST['name'];
$POST[2]= $_POST['address'];
$POST[3]= $_POST['actnum'];
$POST[4]= $_POST['status'];
$POST[5]= $_POST['remarks'];
return $posts;
}

if(isset($_POST['search']))
{
$data = getPosts();

$search_Query = "SELECT * FROM thetable WHERE id = $data[o]";

$search_Result = mysqli_query($conn, $search_Query);
}

if ($search_Result)
{

if (mysqli_num_rows{$search_Result})
{
while($row = mysqli_fetch_array($search_Result)}
{

$id =$row['id'];
$name =$row['name'];
$address =$row['address'];
$status =$row['status'];
$remarks =$row['remarks'];

}else {

echo 'No Data For This Id');
}

}else {

echo 'Result Error';
}
}
?>

1 Answers1

0

I think you need to change that line to

if (mysqli_num_rows($search_Result))

If hope this will fix the error

HOSSAIN AZAD
  • 104
  • 4