Jump to content

Mysqli->prepare SELECT FROM NOT WORKING


ArshSingh
Go to solution Solved by 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.