simple but baffling

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

    simple but baffling

    a simple sql query below has me baffled .dont take much i know.

    its for spincards game in chatroom. its not selecting the correct winner.

    i have narrowed it down to this statement.

    Code:
    $rpgd = mysql_query("SELECT id, cards FROM dave_users ORDER by cards DESC LIMIT 1");
     while($rpgds=mysql_fetch_array($rpgd))
    appreciate any help ta
    Wapchat4u


    Topsites4u

    #2
    what u want it to select? and what is it selectinf istead.

    for the id is gona be rpgds[0] and for cards its gna be rpgds[1]
    Want something coded email me at sales@webnwaphost.com for a prices.




    Comment


      #3
      the person with highest number of cards .or the biggest number to make it simpler.

      its selecting the one with the least i think as someone had 273 or sumat and the person who had 5 won. . ???
      Wapchat4u


      Topsites4u

      Comment


        #4
        change this

        Code:
        $rpgd = mysql_query("SELECT id, cards FROM dave_users ORDER by cards DESC LIMIT 1");
        to this
        Code:
        $rpgd = mysql_query("SELECT id, cards FROM dave_users ORDER by cards ASC LIMIT 1");
        Want something coded email me at sales@webnwaphost.com for a prices.




        Comment


          #5
          ok will try that thanks
          Wapchat4u


          Topsites4u

          Comment


            #6
            what your code was doing was finding it but ordering the output in a decending order hence the desc beign there which means itl output the lowest value first and the greater value last, what i had done was changed this to asc which is asending which outputs the greater value first and then the least last.
            Want something coded email me at sales@webnwaphost.com for a prices.




            Comment


              #7
              i had looked at some other statements wasnt sure which on e to use. every script that has got this in is wrong then lol .
              Wapchat4u


              Topsites4u

              Comment


                #8
                yes and no, you can filter the values out it all depends, but i asume from your reply all is in working order.
                Want something coded email me at sales@webnwaphost.com for a prices.




                Comment


                  #9
                  dunno yet . am still testing it . gonna have to speed things up tho .
                  Wapchat4u


                  Topsites4u

                  Comment


                    #10
                    na not work . user with no cards won lol
                    Wapchat4u


                    Topsites4u

                    Comment


                      #11
                      lol your like granny u are lol
                      Want something coded email me at sales@webnwaphost.com for a prices.




                      Comment


                        #12
                        what page is this on ur site al look at it in the mornign when i ent so pisssed off
                        Want something coded email me at sales@webnwaphost.com for a prices.




                        Comment


                          #13
                          just go to chatrooms and enter spin for plusses room.

                          ave put it back to wot it was .
                          Wapchat4u


                          Topsites4u

                          Comment


                            #14
                            Code:
                            $rpgd = mysql_query("SELECT id, MAX(cards) FROM dave_users GROUP BY id LIMIT 1");
                             while($rpgds=mysql_fetch_array($rpgd)){ echo $rpgds['MAX(card)'] }

                            Comment


                              #15
                              ok found the problem wasnt anything to do with the coding. done some research about sql and the database was wrong

                              this is wot i used which i got off 2 other scripts
                              Code:
                               `cards` varchar(10) NOT NULL,
                              now it should of been
                              Code:
                               `cards` int(10) NOT NULL,
                              apparently a text value 7 is higher than 123445 but a numeric value is obvious lower in which case it was selecting the wrong winner all the time .

                              u learn something new everyday lol
                              Wapchat4u


                              Topsites4u

                              Comment

                              Working...
                              X