Io vorrei far fare un inserimento se $result è vuoto, il problema è che se è vuoto non mi va avanti e quindi non legge l'if. Come faccio?
Codice PHP:
$result2 = mysql_query("select * from banner ORDER BY id DESC LIMIT 0,1");
$result = mysql_query("SELECT * FROM banner WHERE data_inizio <= NOW() and data_fine >= NOW() ORDER BY RAND() LIMIT 0,1");
while($dati = mysql_fetch_array($result))
while($dati2 = mysql_fetch_array($result2))
if (empty($result))
{
mysql_query("INSERT INTO banner (`id`,`nome`, `type`, `width`, `height`, `testo`, `testo_click`, `url`, `cod_agenti`, `titolo`, `target`, `alt`, `data_inizio`, `data_fine`) VALUES ('', '$dati2["nome"]','$dati2["type"]','$dati2["width"]','$dati2["height"]','$dati2["testo"]','$dati2["testo_click"]','$dati2["url"]', '$dati2["cod_agenti"]', '$dati2["titolo"]','$dati2["target"]','$dati2["alt"]','now()','now()')");
}