When I'm using SQL select statements with prepared statements code works fine and display content when I'm run that in my computer localhost using WAMP server.
But when I'm upload this code to my web hosting. No any result display or no any error display.But without prepared statement code works fine in the web hosting and display results. here is my codes with and without prepared statements. Please tell me why that happens?
Here is my code:
<?php
for($i=0;$i <$count; $i++){
require('connection.php');
$stmt = $connection->prepare("SELECT * FROM comment WHERE status = 'Approved' limit 1 offset ?");
$stmt->bind_param('s', $id);
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0) {
while($row = $result-> fetch_assoc()){
$pst_content = $row['content'];
$author = $row['commentator'];
if($i==0){
echo '<div class="item active">';
echo ' <blockquote>';
echo '<div class="row">';
echo '<div class="col-sm-12">';
echo " <p style='color:#a07936'>$pst_content</p>";
echo "<small>$author</small>";
echo ' </div>';
echo ' </div>';
echo ' </blockquote>';
echo ' </div>';
}else{
echo '<div class="item">';
echo ' <blockquote>';
echo '<div class="row">';
echo '<div class="col-sm-12">';
echo " <p style='color:#a07936'>$pst_content</p>";
echo "<small>$author</small>";
echo ' </div>';
echo ' </div>';
echo ' </blockquote>';
echo ' </div>';
}
}
}
}
?>