Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Dvi užklausos

Parašė Narysx· 2008 Lap. 3 20:11:04
#1

Ar galima darant dvi užklausas, antrojoje naudoti pirmos rezultatą? Pvz.:

$data = mysql_query("SELECT * FROM `prefix_table` WHERE `ga_date` >= $snd AND `ga_date` < $ryt") or die(mysql_error());
while ($a = mysql_fetch_array($data))
{
$gm[] .= $a['ga_id'];
}

$info = mysql_fetch_row(mysql_query("SELECT aaa_bbb, ccc_ddd FROM prefix_table2 WHERE fff_ggg='$namai'"))or die(mysql_error());


$uzklausa=mysql_query("SELECT ga_home_id, ga_id, ga_home_score, ga_away_score, ga_away_id, ga_date from prefix_table3 WHERE ga_id IN (" . implode(',', $gm) . ") ORDER BY lll_mmm");
if (dbrows($uzklausa)) {
$i = 1;
while ($data = dbarray($uzklausa)) {
$i = $i+1;
$tbl = $i%2 == 0 ? "class='tbl2'" : "class='tbl1'";
$namai = $data['ga_home_id'];
$sveciai = $data['ga_away_id'];
$gaid = $data['ga_id'];
$rezh = $data['ga_home_score'];
$reza = $data['ga_away_score'];
$sitas_va = $info['aaa_bbb'];
 $time = date("G:i:s", $data['ga_date']);





Ar tūrėtų veikti toks kodas?

Redagavo Narysx· 2008 Lap. 3 20:11:01