Hi,
Any help on this will be massively appreciated, it is driving me nuts!
I need to include two variables in a query statement.
This is what I have
$query9 = "SELECT * FROM `fixtures` WHERE `wk_id` = '$next_wk'";
$result9 = mysql_query($query9) or die ('Error: Sh2');
while ( $rows9 = mysql_fetch_array($result9) ) {
$fixa1 = $rows9['fixa1'];
$fixa2 = $rows9['fixa2'];
$fixa3 = $rows9['fixa3'];
$fixa4 = $rows9['fixa4'];
$fixa5 = $rows9['fixa5'];
$fixa6 = $rows9['fixa6'];
$fixa7 = $rows9['fixa7'];
$fixa8 = $rows9['fixa8'];
$fixa9 = $rows9['fixa9'];
$fixa10 = $rows9['fixa10'];
$fixa11 = $rows9['fixa11'];
$fixa12 = $rows9['fixa12'];
$fixb1 = $rows9['fixb1'];
$fixb2 = $rows9['fixb2'];
$fixb3 = $rows9['fixb3'];
$fixb4 = $rows9['fixb4'];
$fixb5 = $rows9['fixb5'];
$fixb6 = $rows9['fixb6'];
$fixb7 = $rows9['fixb7'];
$fixb8 = $rows9['fixb8'];
$fixb9 = $rows9['fixb9'];
$fixb10 = $rows9['fixb10'];
$fixb11 = $rows9['fixb11'];
$fixb12 = $rows9['fixb12'];
for ($loop=1;$loop<13;$loop++) {
$loopno = ($loop>0 ? $loop : '');
//////////////// HERES THE PROBLEM /////////
$query1 = "SELECT * FROM `entrants` WHERE `uid` = '$fixa$loopno'";
//////////////////////////////////////////////////////
$result1 = mysql_query($query1) or die ('Error: Sh2');
while ( $rows1 = mysql_fetch_array($result1) ) {
$username4 = $rows1['username'];
echo ("team1-$username4");
}
echo (" <br><br>v <br><br>");
//////////////// HERES THE PROBLEM /////////
$query12 = "SELECT * FROM `entrants` WHERE `uid` = '$fixb$loopno'";
//////////////////////////////////////////////////////
$result12 = mysql_query($query12) or die ('Error: Sh2');
while ( $rows12 = mysql_fetch_array($result12) ) {
$username1 = $rows12['username'];
echo ("team2-$username1");
echo ("$username1<br>");
}
} }
Bascially in the query I want to use two $. And leave a $ at the beginning. Is this possible? I'm sure there must be another way around it, its driving me crazy!!
The result im looking for is for it to say $fixa(loop number i.e1) and $fixb(loop number i.e1) So that it calls from the relevant row on the table. The first fixture from fixa1 and fixb1 the second fixa2 and fixb2, and so on.
Any help appreciated. Thanks.,