I'm building a website in Flash, wich uses PHP to send/get data from a database.
In Flash I have 3 comboboxes, that if selected send to the PHP script their index value. If one of them is not selected, it sends 0 to PHP.
My PHP script is this:
<?php
include("setup.php");
$cat = $GET['cat']; //combobox 1 value
$act = $GET['act']; //combobox 2 value
$pais = $_GET['pais']; //combobox 3 value
$cant = 0;
echo "&";
$result = mysql_query("SELECT local, duracao, distancia_total, data, preco FROM programas WHERE ID_categoria=$cat AND ID_actividade=$act AND ID_pais=$pais");
while($row=mysql_fetch_array($result)){
$cant++;
echo "local$cant=$row[local]&";
echo "duracao$cant=$row[duracao]&";
echo "distancia_total$cant=$row[distancia_total]&";
echo "data$cant=$row[data]&";
echo "preco$cant=$row[preco]&";
}
echo "total_prog=$cant";
?>
The problem is that if one of the comboboxes is not select, with de 0 (zero) value the query fails. Can someone help me?