occhio che e' un esempio....
rivedendo ... dovresti sostituire create con insert per le selezioni successive alla prima. Quindi andrebbe strutturato un attimo diversamente:
codice:
//Prima query
$query = "SELECT * FROM Correlate
WHERE News1 = '$News' OR News2 = '$News'";
$result = mysql_query($query, $db);
if(mysql_num_rows > 0 ) {
$row = mysql_fetch_array($result)) {
$id1 = $row["ID"];
$n1 = $row["News1"];
$n2 = $row["News2"];
$query2 = "CREATE TEMPORARY TABLE IF NOT EXISTS temp
SELECT * FROM News
WHERE (ID = '$n1' OR ID = '$n2')
AND ID != '$News'
AND Data <= Now()" ;
}
if(mysql_num_rows > 1 ) {
while ($row = mysql_fetch_array($result)) {
$id1 = $row["ID"];
$n1 = $row["News1"];
$n2 = $row["News2"];
$query2 = "INSERT INTO TEMPORARY TABLE temp
SELECT * FROM News
WHERE (ID = '$n1' OR ID = '$n2')
AND ID != '$News'
AND Data <= Now()" ;
$result2 = mysql_query($query2, $db);
} // end while
} // end if
il resto uguale a sopra.... occhio che ho scritto qui e quindi rimane da debuggare....