Good day. I have a little problem over here with my first big project. Iam using alot of SQL statements in my code, all of them work perfectly fine, until this point, were I got an error "Trying to get property of non-object". Xammp tells me, that the error is on line 80.
function btngrp(){
global $connect;
global $listedForums;
global $disableUp;
global $disableDown;
$query = 'SELECT * FROM `categories` ORDER BY `categoryRank` ASC';
$results = $connect -> query($query);
if ($results -> num_rows > 0) {
while ($row = $results -> fetch_assoc()) {
echo '<tr class="headlineCat">
<td colspan="2">' . utf8_encode($row['categoryName']) . '</td>
<td class="text-right" width="10px">
<ul class="posBtn">
<li><button name="categoryOben" class="posUp btnWhite" value="' . $row['categoryID'] . '"><i class="fa fa-caret-up iconPosUp" aria-hidden="true"></i></button></li>
<li><button name="categoryUnten" class="posDown btnWhite" value="' . $row['categoryID'] . '"><i class="fa fa-caret-down iconPosDown" aria-hidden="true"></i></button></li>
</ul>
</td>
</tr>' . listItemByCategoryID($row['categoryID']) . $listedForums;
}
} else {
echo '<tr><td>Keine Foren gefunden</td></tr>';
}}
I dont really know where my mistake currently is. I've checked, wether my SQL statement is correct. I've executed it in the control pannel and it worked out, therefor, the SQL syntax has to be correct. And as I already've used alot of sql statements, my $connection has to work aswell.
For some reason this function worked out before. But just as I finished my other function to control the Content which is linked with those buttons (positioning and their rank(priority) the error appears
After some "bug fix tries" I noticed, that $results is empty and cant get any content from the query
This is just a small part of the code, the "form" tag and other important tags are just underneath this part :)
So I guess the syntax is actually correct, but is there something like a statement limit in sql? As I've already used around 25 SQL statements or maybe other things iam unaware of?