Here is the code :
$sorular_hepsi = mysql_query("select * from tblsorular where hafta=1 order by rand() limit 1");
$soru_ust = mysql_fetch_assoc($sorular_hepsi);
$soru_id = $soru_ust_rs["id"];
$soru_grup_id = $soru_ust["sId"];
$sorular = mysql_query("select * from tblsorular where sId=$soru_grup_id");
$sorular_rs=mysql_fetch_array($sorular);
And here is my db schema :
id soru sId hafta
== ==== === =====
1 xxxx 4 1
2 yyyy 4 1
3 zzzz 5 1
And My Query
<?php
$soru1 = $sorular_rs["soru"];
$soru2 = $soru_ust["soru"];
?>
EDIT
I want to get soru1=xxxx and soru2=xxxx values but i know that i have to put some extra request in the second query like .... and id<>$id
at the en of the query. It couldn't work.
EDIT-2
I did something like that :
$sorular_hepsi = mysql_query("select * from tblsorular group by sId order by rand() limit 2");
while($soru_ust = mysql_fetch_assoc($sorular_hepsi)) {
echo "<pre>";
print_r($soru_ust);
and this is the result :
Array
(
[id] => 45
[soru] => İznik Çinisi
[sId] => 23
[hafta] => 1
)
Array
(
[id] => 31
[soru] => Maraş Biberi
[sId] => 16
[hafta] => 1
)
here you can see the sId values. 23 and 16. I want to list them only same group elements.
struggling hard!
Any suggestions?