0
votes

I am learning php. I am getting this error

Fatal error: Uncaught Error: Call to undefined method mysqli::execute() in C:\xampp\htdocs\search\index.php:58 Stack trace: #0 {main} thrown in C:\xampp\htdocs\search\index.php on line 58

Here the line 58 is

<?php
    include'config.php';
    $stmt=$conn->prepare("SELECT * FROM info");
    $conn->execute(); // This line
    $result=$stmt->get_result();
 ?>                            

I am trying to create a simple live search.

1
You are trying to “execute” your connection, you need to execute the statement instead.CBroe
Oh yah Thanks. It's working now.twilight_star

1 Answers

0
votes

Call the method execute() on $stmt object instead.

 include 'config.php';
 $stmt = $conn->prepare("SELECT * FROM info");
 $stmt->execute(); // you are executing connection here
 $result = $stmt->get_result();