First of all, sorry for my bad English (I used google translate). I already read many forums but I can not find the answer. I only know that the error is in mysqli_stmt_execute ($ stmt2) ;. I would like to keep it in Procedural style.
if(isset($_GET['subject'])){
echo"<table>";
$stmt = mysqli_prepare($mysqli,"SELECT * FROM `***`.`topics` WHERE categorie = ?");
$stmt2 = mysqli_prepare($mysqli,"SELECT username FROM `***`.`users` WHERE id = ?");
//pakketje maaken
mysqli_stmt_bind_param($stmt, 'i' , $_GET['subject']);
mysqli_stmt_bind_param($stmt2, 'i' , $by);
//uitvoeren
mysqli_stmt_execute($stmt);
//resultaat naar php variablen
mysqli_stmt_bind_result($stmt, $id , $question , $categorie , $by , $date);
while (mysqli_stmt_fetch($stmt)) {
mysqli_stmt_execute($stmt2);
mysqli_stmt_bind_result($stmt2, $bb);
echo'<tr><td>
<fieldset id="'.$id.'" onClick="types(this.id)">
<table class="forumposts">
<tr><td><b>'.$question.'</b></td><td>'.$bb.'</td><td>'.$date.'</td></tr>
</table>
</fieldset></td></tr>';}
mysqli_stmt_close($stmt2);
mysqli_stmt_close($stmt);
echo'</table><script>
function types(clicked_id){
var c = clicked_id;
window.location.href = "http://www.***.be/forum/index.php?subject='.$categorie.'&question="+c;
}
</script>';