chat quiz.

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

    chat quiz.

    ok guys got this code from the chat.php in wap.net.ph

    its part of the quiz code . my problem is it seems to be only selecting the one question which is id 14 out 30 . which would suggest to me its the middle one all the time as the code suggests its gets the max and min question.

    Code:
    $range_result = mysql_query( " SELECT MAX(`id`) AS max_id , MIN(`id`) AS min_id FROM `ibwf_quiz` ");
    $range_row = mysql_fetch_object( $range_result ); 
    $random = mt_rand( $range_row->min_id , $range_row->max_id );
    $result = mysql_query( " SELECT question, answer, id FROM `ibwf_quiz` WHERE `id` >= $random LIMIT 0,1 ");
    while($rpgds=mysql_fetch_array($result))

    can anyone help me so it selects the questions at either totally random or in order.

    thanks .
    Wapchat4u


    Topsites4u

    #2
    can anyone help here with this . it inserting new questions now but even when a user answers the correct answer it says nobody answerd correctly.

    heres the full file .
    Attached Files
    Wapchat4u


    Topsites4u

    Comment


      #3
      Originally posted by nclemale36 View Post
      can anyone help here with this . it inserting new questions now but even when a user answers the correct answer it says nobody answerd correctly.

      heres the full file .
      copy table ibwf_quiz and create table ibwf_quizrooms..just remove i think answers 2, 3..and 4?
      My Blog: http://jhommark.blogspot.com
      My Facebook: http://www.facebook.com/jhommark
      My Official Site: http://www.undergroundweb.tk
      My Community Site: http://undergroundwap.xtreemhost.com

      Comment


        #4
        i have all tables required to make this work . like i say it dont pick up the answer inserted . ??
        there is a quiz table and a quizroom table needed .
        Wapchat4u


        Topsites4u

        Comment


          #5
          no as i said lol i got all the tables i need are correct .
          Last edited by nclemale36; 02.09.09, 21:14.
          Wapchat4u


          Topsites4u

          Comment


            #6
            Originally posted by nclemale36 View Post
            i have all tables required to make this work . like i say it dont pick up the answer inserted . ??
            there is a quiz table and a quizroom table needed .
            just use ur head here, i'll give u the codes..no more questions..put this inside if(!isblocked($message,$uid))..
            change the rid of your quiz room..
            PHP Code:
            if($rid==15)
            {
            $msg $message;
            $ans "/$question2/i";
            if(!
            preg_match($ans$msg))
            {
             
            $by getnick_uid($uid);
            echo 
            "<b>Chat system</b>» $by, sorry your answer is wrong. You've been deducted 2 plusses. Please try again!!!<br/>";
            mysql_query("UPDATE ibwf_users SET plusses=plusses-'2' WHERE id='".$uid."'");
            }else{
            $range_result mysql_query("SELECT MAX(`id`) AS max_id, MIN(`id`) AS min_id FROM `ibwf_quiz`");
            $range_row mysql_fetch_object($range_result);
            $random mt_rand($range_row->min_id $range_row->max_id);
            $result mysql_query("SELECT question, answer, id FROM `ibwf_quiz` WHERE `id` >= $random LIMIT 0,1");
            while(
            $rpgds=mysql_fetch_array($result))
            {
            $winner $rpgds[0];
            $winner2 $rpgds[1];
            }
             
            mysql_query("DELETE FROM ibwf_quiz WHERE id='".$question3."'");
            mysql_query("INSERT INTO ibwf_quizrooms SET displaytime='".time()."', question='".$winner."', answer='".$winner2."'");
            $by getnick_uid($uid);
            $csmsg "$by, you are correct. you got $kano plusses. Next question!!!";
            $csm "$by, i'm sorry but it's already time out!!!";
            if(
            $kano!="")
            {
            echo 
            "<b>Chat system</b>» ".$csmsg."<br/>";
            mysql_query("UPDATE ibwf_users SET plusses=plusses+'$kano' WHERE id='".$uid."'");
            }else{
            echo 
            "<b>Chat system</b>» ".$csm."<br/>";
            mysql_query("UPDATE ibwf_users SET plusses=plusses+'$kano' WHERE id='".$uid."'");
            }
            mysql_query("DELETE FROM ibwf_quizrooms WHERE id='".$question3."'");
            }

            My Blog: http://jhommark.blogspot.com
            My Facebook: http://www.facebook.com/jhommark
            My Official Site: http://www.undergroundweb.tk
            My Community Site: http://undergroundwap.xtreemhost.com

            Comment


              #7
              thanks mate i will give it a go .
              Wapchat4u


              Topsites4u

              Comment


                #8
                if question selects from sql base, than in selection query put
                Code:
                ORDER BY RAND
                Nous Ne Dansos Pas, Nous Sommes Le Danse.!

                Comment

                Working...
                X