Jump to content

Mysqli->prepare SELECT FROM NOT WORKING


ArshSingh

Recommended Posts

hi there , so my problem is that im trying to select rows from database with mysqli->prepare for search autosuggestion, its not giving me a error but its not displaying ; poster , title , id that i have selected from database , i have other queries also and they work , but this ome is not working , here is the full code : a help would be great. 

 

<?php
include("../secure/functions.php");


 if($_POST) 
{ 
$q=$_POST['searchword']; 


$stmt = $mysqli->prepare("SELECT `id`,`title`,`poster`,`story`,`director` FROM `movies` WHERE `title` like CONCAT('%', ?, '%')"); 
$stmt->bind_param('s', $q);
        $stmt->execute(); // Execute the prepared query.
if($stmt->num_rows == 1) {
$stmt->bind_result($id,$title,$poster,$story,$director); // get variables from result.
           $stmt->fetch();
}  


}
?>
<a href="movie?title=<?php echo $title;?>">
<div class="display_box" align="left">


<img src="<?php echo $poster; ?>" /><?php echo $title; ?><br/>
<span style="font-size:9px; color:#999999"><?php echo $director; ?></span></div></a>

 

Link to comment
https://forums.phpfreaks.com/topic/287564-mysqli-prepare-select-from-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.