Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
954 views
in Technique[技术] by (71.8m points)

php - Fatal error: Uncaught Error: Call to undefined method mysqli::execute()

I am learning php. I am getting this error

Fatal error: Uncaught Error: Call to undefined method mysqli::execute() in C:xampphtdocssearchindex.php:58 Stack trace: #0 {main} thrown in C:xampphtdocssearchindex.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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...