Hi Everybody,
Lately i have been working on relational database of two table in php/mysql in INNER JOIN. I want to associate author name and email with theirs quotes in the display for the delete.
but i got some errors message which are:
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given
Warning: Invalid argument supplied for foreach()
Advise and tips will help. THANK YOU
here are my code:
[php]
if ($_SERVER[“REQUEST_METHOD”]==“POST”) {
$id_select = $_POST[‘id’];
$action = “DELETE FROM user_quotes WHERE id = ‘$id_select’”;
$requet= mysqli_query($db_connection, $action);
}
echo “
”;
$requete = “SELECT joke.id, quoteText, name, email FROM user_quotes INNER JOIN author ON authorID = author.id”;
$resultat = mysqli_query($db_connection, $requete);
while ($rows = mysqli_fetch_assoc($resultat)) {
$quotes []= array(‘id’ =>$rows[‘id’], ‘text’ =>$rows[‘quoteText’], ‘name’=>$rows[‘name’], ‘email’=>$rows[‘email’]);
}
?
Thank you for your participation
<?php foreach ($quotes as $quote):?><?php endforeach; ?> [/php]<?php echo htmlspecialchars($quote['text'], ENT_QUOTES, 'UTF-8'); ?> <?php echo htmlspecialchars($quote['name'], ENT_QUOTES, 'UTF-8'); ?> <?php echo htmlspecialchars($quote['email'], ENT_QUOTES, 'UTF-8'); ?>