Hello,
I know this is an easy fix but for some reason its escaping me right now. I am trying to print the resutls of a query that is stored in variables but I keep getting the word "array" where the number is suppose to be. Here is my code:
Any help would be great. I know its easy I just cant seem to find it.PHP Code:$q = "SELECT COUNT(forum_id) FROM forums";
$r = mysqli_query($dbc, $q);
$fcount = mysqli_fetch_array ($r, MYSQLI_NUM);
$q = "SELECT COUNT(thread_id) FROM threads";
$r = mysqli_query($dbc, $q);
$tcount = mysqli_fetch_assoc ($r);
$q = "SELECT COUNT(post_id) FROM posts";
$r = mysqli_query($dbc, $q);
$pcount = mysqli_fetch_assoc ($r);
echo "<h3 class=\"stats\"> Forum Stats:<br />";
echo"<p>Total Forums: $fcount <br />";
echo" Total Threads: $tcount <br />";
echo" Total Posts: $pcount <br /><br />";
if (isset($_SESSION['user_id'])) {
$q = "SELECT COUNT(post_id) FROM posts WHERE user_id = {$_SESSION['user_id']}";
$r = mysqli_query($dbc, $q);
$iposts = @mysqli_fetch_assoc ($r);
echo "Your Total Posts: $iposts </p>";


Reply With Quote
Bookmarks