The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Trouble with DB results - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Documentation (https://userspice.com/forums/forumdisplay.php?fid=30)
+--- Thread: Trouble with DB results (/showthread.php?tid=161)



Trouble with DB results - Nolan - 06-14-2016

Hello.

First let me say that I haven't messed around with PHP for quite some time. I used to be fairly good with the language around 10 years ago but stopped programming until recently again.

I love how you made a pretty nice user system here and I thank you for that.

I am having trouble with getting results from the query though... Here is what the page looks like.

[Image: 1.png]

and here is the code I have...

[Image: 2.png]

I tried doing mysql_num_rows but I couldn't get a count on the rows that way either.


Any help would be of great help.

Thank you!


Trouble with DB results - mudmin - 06-15-2016

It's been a little while since I've used the count method, so I had to confirm. I put a method in the db class that does this for you. You can do something like this.

Code:
$query = $db->query("SELECT * from users");
Code:
$count = $db->count();
Code:
echo $count;

You can also see that kind of coding in action at the top of the admin panel. I hope that helps.