Page 1 of 1

Database Not Echoing Properly

Posted: Sat Sep 27, 2014 7:42 am
by Epiales
I've spent a few hours and I can't figure out the error. It's so darn simple it's hard :lol: :lol: :lol: :lol:

Why won't it echo the database?

Image

Re: Database Not Echoing Properly

Posted: Sat Sep 27, 2014 7:50 am
by Jackolantern
If even your test echo is not printing, that means your WHILE loop isn't running. I would start investigating there to see what you are actually getting into the $row. If $row is empty the first time the WHILE runs, it will be skipped.

Re: Database Not Echoing Properly

Posted: Sat Sep 27, 2014 9:06 am
by Epiales
Jackolantern wrote:If even your test echo is not printing, that means your WHILE loop isn't running. I would start investigating there to see what you are actually getting into the $row. If $row is empty the first time the WHILE runs, it will be skipped.
Well if I take this out of the file:

Code: Select all

while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) {
Then it will display the first item and all its rows but not the other items. Only the first one. For some reason, the while is just not working and it doesn't make sense. It even displays the items picture, but only for the first item, and if I put the while back in, it removes it all except the headers I created above.

This is the actual echo statement I use to list the items:

Code: Select all

echo "<tr align='left'><td><img src = '".$row['image']."'height='100' width='100'></td><td>$row[name]</td><td>$row[strength]</td><td>$row[defense]</td><td>$row[price]</td><td><A href='buy_item.php?randid=$row[randid]'><font color='red'>Buy Item</font></td></tr>";
So in otherwords, my echo is written correctly, because when I remove the while loop, it does echo the first row in the database, but not the other rows. We need a pull u're hair out emoticon :D :D :D

Re: Database Not Echoing Properly

Posted: Sat Sep 27, 2014 9:35 am
by Epiales
Oh Lord.... I had for location : United States..... it's supposed to be United States of America :D :D :D :D :D

Thanks for telling me to further dig into the while and see the rows.

Re: Database Not Echoing Properly

Posted: Sat Sep 27, 2014 3:45 pm
by Jackolantern
No problem! Glad you fixed it :)