Hallo i try to make a simple quiz application in php based on math tests from many years. I have database with such columns:
-id
-pytanie
-a
-b
-c
-d
-poprawna
-rok_id
-typ_id
I use rand function to get random id and next i use this in sql answer to get random question. However id dont know how get radnom question for example random one question include yera_id=1
Firstly i use $numer=rand(1,1800) My sql select is such as\
select pytanie, a,b,c,d, nazwa, rok_liczba, nazwa_typu, poprawna from pytania left join rok on rok.id= pytania.rok_id left join typ on typ.id=pytania.typ_id where typ_id=1 and pytania.id=".$numer.""
When i add to sql select ,,where year_id=1" i must click many time to hit when rand get 1 beacuse otherwise i dont get any resoult. It possible to rand from records ho are resoult a sql answer ?