query sql problem
#1

Hello, I would like to display in a dialog with a list of six random names in my database but I do not know how to select six matches at random.

If it were possible to give me a sample code or explain to me how you actually do I would be very grateful.

Vince

PS: I'm French sorry for spelling!
Reply
#2

Код:
SELECT * FROM `tablename` ORDER BY RAND() LIMIT 6
Should work.
Reply
#3

Thanks Vince



One last question:

I have 20 vehicles on my server and I would put all the players connected to a vehicle and the vehicle is unoccupied should be deleted, I made this code but I do not think it works, what do you think ?

Код:
Stock MettreJoueurVoiture ()
{
for (new i; i <MAX_PLAYERS; i + +)
     {
         new id = 0;
         if (id! & id = 16 & <16)
         {
         PutPlayerInVehicle (i, vi, 0);
         vi + +;
         return 1;
         }
         else
         {
             DestroyVehicle (vi);
         }
     }
}
Thanks !
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)