help in this code?????

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    help in this code?????

    PHP Code:
    <?

    $result_get_user_info = mysql_query("SELECT * FROM users WHERE id='$uid'");
    $user_info = mysql_fetch_array($result_get_user_info);

    $result_get_banner = mysql_query("SELECT user_login FROM users WHERE imp_left > 0 AND act='1' AND numban > 0");

    while ($banner = mysql_fetch_array($result_get_banner)){
    $bid[] = "$banner[user_login]";
    }
    $ip = getenv ("REMOTE_ADDR");
    srand ((float)microtime()*1000000);
    shuffle ($bid);
    srand ((float)microtime()*1000000);
    shuffle ($bid);

    $id = "$bid[0]";
    $id2 = "$bid[1]";

    $checkban = "$banner[lastbannerid]";
    If ($id == "$checkban"){
    $id = "$bid[1]";
    }

    ElseIf ($id == ""){
    $id = "$bid[1]";
    }

    ElseIf ($id != "$checkban" || $id != ""){}

    mysql_pconnect("$dbhost", "$dbuser", "$dbpass")
                or die ("Unable to connect to database.");
            mysql_select_db("$dbname")
                or die ("Unable to select database.");
    If ($id != "$user_info[user_login]"){
    $result_get_banner_info = mysql_query("SELECT * FROM banners WHERE user='$id'");

    $banner_info = mysql_fetch_array($result_get_banner_info);
    }
    If ($id == "$user_info[user_login]"){
    mysql_pconnect("$dbhost", "$dbuser", "$dbpass")
                or die ("Unable to connect to database.");
            mysql_select_db("$dbname")
                or die ("Unable to select database.");
    $result_get_banner_info = mysql_query("SELECT * FROM banners WHERE user='$id2'");
    $banner_info = mysql_fetch_array($result_get_banner_info);
    }

    ?>
    its giving error in line 13 and 15

    Warning: shuffle() expects parameter 1 to be array, null given in /public_html/abc/inc/showbanner/getbanner.inc on line 13

    Warning: shuffle() expects parameter 1 to be array, null given in /public_html/abc/inc/showbanner/getbanner.inc on line 15

    line #13 and 15 are
    shuffle ($bid);

    http://WapTops.com- Get Real High Traffic
    http://WapFun.info-Fun 4 Wap

    #2
    Code:
    <? 
    
    $result_get_user_info = mysql_query("SELECT * FROM users WHERE id='$uid'"); 
    $user_info = mysql_fetch_array($result_get_user_info); 
    
    $result_get_banner = mysql_query("SELECT user_login FROM users WHERE imp_left > 0 AND act='1' AND numban > 0"); 
    
    while ($banner = mysql_fetch_array($result_get_banner)){ 
    $bid[] = "$banner['user_login']"; 
    } 
    $ip = getenv ("REMOTE_ADDR"); 
    srand ((float)microtime()*1000000); 
    shuffle($bid); 
    srand ((float)microtime()*1000000); 
    shuffle($bid); 
    
    $id = "$bid[0]"; 
    $id2 = "$bid[1]"; 
    
    $checkban = "$banner[lastbannerid]"; 
    If ($id == "$checkban"){ 
    $id = "$bid[1]"; 
    } 
    
    ElseIf ($id == ""){ 
    $id = "$bid[1]"; 
    } 
    
    ElseIf ($id != "$checkban" || $id != ""){} 
    
    mysql_pconnect("$dbhost", "$dbuser", "$dbpass") 
                or die ("Unable to connect to database."); 
            mysql_select_db("$dbname") 
                or die ("Unable to select database."); 
    If ($id != "$user_info[user_login]"){ 
    $result_get_banner_info = mysql_query("SELECT * FROM banners WHERE user='$id'"); 
    
    $banner_info = mysql_fetch_array($result_get_banner_info); 
    } 
    If ($id == "$user_info[user_login]"){ 
    mysql_pconnect("$dbhost", "$dbuser", "$dbpass") 
                or die ("Unable to connect to database."); 
            mysql_select_db("$dbname") 
                or die ("Unable to select database."); 
    $result_get_banner_info = mysql_query("SELECT * FROM banners WHERE user='$id2'"); 
    $banner_info = mysql_fetch_array($result_get_banner_info); 
    } 
    
    ?>
    Trail how to use shuffle function

    Code:
    <?php
    $my_array = array("a" => "Dog", "b" => "Cat", "c" => "Horse");
    
    shuffle($my_array);
    print_r($my_array);
    ?>
    The output of the code above could be:

    Code:
    Array ( [0] => Cat [1] => Horse [2] => Dog )
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      bro, just tell me what to do?

      http://WapTops.com- Get Real High Traffic
      http://WapFun.info-Fun 4 Wap

      Comment


        #4
        PHP Code:
        $bid "$banner[user_login]"

        Comment


          #5
          The awnser is there, bid is null that means u have a broken query or bid wasnt set properly

          Comment


            #6
            $result_get_banner = mysql_query("SELECT user_login FROM users WHERE imp_left > 0 AND act='1' AND numban > 0");

            is only selecting 1 item so there is no $bid[1]

            Comment


              #7
              $result_get_banner = mysql_query("SELECT user_login FROM users WHERE imp_left > 0 AND act='1' AND numban > 0");
              is this query right ?
              write
              PHP Code:
              echo mysql_error(); 
              below maybe there is no results for this query

              Comment

              Working...
              X