Online Users/mood Error

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

    Online Users/mood Error

    scotspaul script. but updated . just been trying to get online mood sorted . which i have with smilies included. but wen a member comes on without a mood set. i get a error . cant work out if its a sql error or a script error.
    heres the script.

    <?php
    ob_start();
    header("Cache-Control: no-cache, must-revalidate");
    include("config.inc.php");
    header("Pragma: no-cache");
    header("Content-type: text/vnd.wap.wml");
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
    echo "<wml>";
    $Connect = mysql_connect("$server","$user","$pass");
    mysql_select_db("$dbname");
    $result=mysql_query("select * from members where username=&#39;$username&#39; and password=&#39;$password&#39;");
    $number_of_rows = mysql_num_rows($result);
    if ($number_of_rows>0)
    {
    include("check.inc.php");
    }
    if ($ok>0)
    {
    include("smilies.inc.php");

    $uonline = mysql_num_rows(mysql_query("select * from latest"));
    //this variable might seem complicated, but it&#39;s really simple. The first thing it does is sends the query "select * from latest" to the database. This finds all the entries in the database. After that, it counts the number of entries with mysql_num_rows to find out exactly how many users are online.

    //print the variable on our page!
    echo "<card id=\"card1\" title=\"$uonline Users Online\">";
    echo "<p align=\"center\">";
    $id=1;
    ?>
    [img]onlinelist.gif[/img]

    <?php
    $datime=date("H:i");
    $dadate=(date("j/m/y"));
    $sqlthing = mysql_query("SELECT * FROM highest WHERE id=&#39;$id&#39;");
    $highest=(mysql_result($sqlthing,0,"highest"));
    if ($highest < $uonline)
    {
    $highest=$uonline;
    $query = "update highest set highest=&#39;$highest&#39; where id=&#39;$id&#39;";
    mysql_query($query); //send the query!
    }
    echo "Highest Online: $highest
    ";

    if(!isset($_GET[&#39;page&#39;])){
    $page = 1;
    } else {
    $page = $_GET[&#39;page&#39;];
    }

    $max_results = 15;
    $from = (($page * $max_results) - $max_results);

    $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM latest"),0);
    $total_pages = ceil($total_results / $max_results);

    $sql = mysql_query("SELECT * FROM latest ORDER by ip asc LIMIT $from, $max_results");
    while($row = mysql_fetch_array($sql)){
    $name = $row[&#39;ip&#39;];



    $resultST=mysql_query("select * from members where username=&#39;$name&#39; and stars=&#39;1&#39;");
    $number_of_rowsST = mysql_num_rows($resultST);
    if ($number_of_rowsST == 1){
    $stars = "*";
    }
    else
    {
    $stars = "";
    }










    $sqlM = mysql_query("SELECT * FROM mood WHERE username=&#39;$name&#39;");
    $gbvalues=(mysql_result($sqlM,0,"mood"));


    include("smilies.inc.php");

    $sqlSHY = mysql_query("SELECT * FROM members WHERE username=&#39;$name&#39;");
    $SHY=(mysql_result($sqlSHY,0,"shy"));


    if ($gbvalues < 0)
    {

    $gbvalues = "am a lazy wapper";}




    include("smilies.inc.php");

    $sqlSHY = mysql_query("SELECT * FROM members WHERE username=&#39;$name&#39;");
    $SHY=(mysql_result($sqlSHY,0,"shy"));


    if ($result3 == ""){
    $mood = "am a lazy wapper";}


    if ($SHY == "1"){
    echo "";
    }
    else
    {
    echo "<a href=\"profile.php?name=$name&amp;username=$userna me&amp;password=$password\">$stars$name$stars$bs</a>
    ($gbvalues)
    " ;
    }

    }

    if($page < $total_pages){
    $next = ($page + 1);
    echo "<a href=\"".$_SERVER[&#39;PHP_SELF&#39;]."?page=$next&amp;username=$username&amp;password= $password\">(Next)</a>
    ";
    }
    if($page > 1){
    $prev = ($page - 1);
    echo "
    <a href=\"".$_SERVER[&#39;PHP_SELF&#39;]."?page=$prev&amp;username=$username&amp;password= $password\">(Prev)</a>
    ";
    }
    $i = 1; $i <= $total_pages; $i++ ;

    ?>



    [img]bar.gif[/img]



    <?php
    $sqlthing = mysql_query("SELECT * FROM members WHERE username=&#39;$username&#39;");
    $pmname=(mysql_result($sqlthing,0,"pmname"));
    $buddyname=(mysql_result($sqlthing,0,"buddyname")) ;

    echo "<a title=\"Enter\" href=\"pm.php?username=$username&amp;password=$pas sword\">($pmname Menu)</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"moodset.php?username=$username&amp;password =$password\">(Change Mood)</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"forumindex.php?username=$username&amp;passw ord=$password\">(Forums)</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"chatindex.php?username=$username&amp;passwo rd=$password\">(Chat)</a>";
    echo "
    ";
    echo "<a title=\"Enter\" href=\"welcome.php?username=$username&amp;password =$password\">(Main Menu)</a>";
    echo "
    ";
    }
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    $contents = ob_get_contents();
    ob_end_clean();
    $contents = str_replace("&amp;", "&", $contents);
    $contents = str_replace("&", "&amp;", $contents);
    print($contents);
    ?>


    the error i get is . Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 27 in whosonline.php on line 82

    can anyone help please . ta
    Wapchat4u


    Topsites4u

    #2
    oooh good luck with that, its very time consuming to fix if you have a lot of members, u need to add each member manually to the moods section of the database, no need to put anything in the mood, just have a line with each members username, also make sure you&#39;ve put the edited check.php file on your site or new members wont be added properly, or add the following to your current check.php file

    $sql = "INSERT INTO mood (username) VALUES
    (&#39;$username&#39;)";
    $result = mysql_query($sql);
    :p:p:p

    Comment


      #3
      i gave you the code before its the check.php file not that one, make it insert something into the mood on registration and it&#39;ll work

      Comment


        #4
        i think his comment referred to members currently on the site bomb, it looks like my edit he&#39;s using, i had the same prob lol
        :p:p:p

        Comment


          #5
          yeah its an updated script tho. looks like ave sorted it before i read the replies . would like to know how to enter a mood wen the user cant be bothered to put one in. seen it on other sites. i think i was putting that code in the wrong place bomb. long story lol. cheers guys
          Wapchat4u


          Topsites4u

          Comment


            #6
            edit the table and change NULL to the mood u choose
            :p:p:p

            Comment


              #7
              i told ya what to do mate, delete ya whole Database get people to sign up again and booom, problem solved.. or you will have to ask every member to add a mood or your have to set there mood your self with the database... i do have a owner tool what i made to delete EVERY mood on the site and replace it with a blank mood, it stops a lot of errors

              Comment


                #8
                as much as i would like to get rid of the error i aint deleting all members . its took me 2 month to get it wer it is now . not that is anywer lol.
                think its sorted anyway
                cheers
                Wapchat4u


                Topsites4u

                Comment


                  #9
                  Only if you try you cant have succes in this mater

                  Comment

                  Working...
                  X