www.webdeveloper.com
Results 1 to 2 of 2

Thread: Printing Variables

  1. #1
    Join Date
    Feb 2012
    Posts
    102

    Question Printing Variables

    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:
    PHP Code:
    $q "SELECT COUNT(forum_id) FROM forums";
            
    $r mysqli_query($dbc$q);
            
    $fcount mysqli_fetch_array ($rMYSQLI_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>"
    Any help would be great. I know its easy I just cant seem to find it.

  2. #2
    Join Date
    Feb 2012
    Posts
    102
    Figured it out should have been $fcount['forum']

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles