Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Dec 2003
    Posts
    3
    Member #
    4363
    PHP Code:
     if($_SESSION['session_id']){    
         
    $teamname $_GET['teamname'];
         
    $connect mysql_connect('xxxxxxx','xxxxxx','xxxxxxx');    
         
    mysql_select_db('lithium_poolid' $_SESSION['session_id'], $connect);
         
    $nopquery "SELECT count(*)  FROM `rosters`WHERE Team='" $teamname "'";
         
    $numplayer mysql_fetch_array($nopquery);
         
    $query2 mysql_query("SELECT Players FROM `options`");
         
    $db2 mysql_fetch_array($query2);
         echo 
    "<table width=\"250\" border=\"0\">";
         echo 
    "<tr><td bgcolor=\"eeeeee\">" $teamname "</td><td align=\"right\" 
           bgcolor=\"eeeeee\">" 
    $numplayer "/" $db2['Players'] . "</td></tr>"
    It currently stalls on the $numplayer = mysql_fetch_array($nopquery) line. This makes me think that the previous SELECT statement is not giving out a value.

    The teamname variable comes through the URL. I have tested to make sure that it successfully comes and it does. Have also tested the SQL query in phpmyadmin and it went through successfully. Their is more code after this so that is why you don't see the initial if statement end, but this is the only code that is relevant to the problem.

    Hopefully someone can give me a hand...

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You must run the query and then use fetch_array:
    PHP Code:
    $result mysql_query($nopquery);
    $numplayer mysql_fetch_array($result); 
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Junior Member
    Join Date
    Dec 2003
    Posts
    3
    Member #
    4363
    Oh god I feel like an idiot. I guess thats what I get for 5 hours of sleep last night. :dead:

    Thanks though.

  5. #4
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Adding to what filburt said, type in this to see if it worked:

    PHP Code:
    echo $numplayer['Count(*)']; 
    JR

  6. #5
    Senior Member [Li] Brad's Avatar
    Join Date
    Oct 2003
    Location
    Saskatoon, Canada
    Posts
    578
    Member #
    3689
    You're right, JR, based on the old code, the count outputs "Array" so we had to use
    PHP Code:
    $numplayer['count(*)'
    as you say, and it works fine.

    [Li] Brad
    "Art strives for form, and hopes for beauty." - George Bellows


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:15 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com