[php]<?php
require ‘database.php’;
//if (!empty($_POST[‘search’])):
$sql1 = “SELECT * FROM cookies2 WHERE cookie LIKE '%”.$_POST[‘search’]."%’";
$request1 = $conn->prepare($sql1);
$request1->bindparam(’:search’, $_POST[‘search’]);
$request1->execute();
$result1 = $request1->fetch(PDO::FETCH_ASSOC);
var_dump($request1);
$ff = $result1[‘cookie’];
//endif;
?>
<?php
if(!empty($request1)):
while($search_result = $request1->fetch(PDO::FETCH_ASSOC)){
var_dump($search_result);?>
<h1>baaaaaa</h1>
<p><?= $search_result['cookie']?></p>
<h3><?= $search_result['comment']?></h3><?php }
endif;
?>
Hello Im trying w simple script to loop through my cookie database
but search_result" is returning false or empty half the time
and i tried different things indent code etz
and different if statements
please help see if i missed something>?