este es mi listado php
Código HTML:
<?php
include "config.php";
$nombrecir=$_SESSION['namecirc'];
$query = "SELECT city FROM `sites` WHERE nombreCirc='".$nombrecir."'";
$result = mysql_query($query);
$numero = 0;
while($row = mysql_fetch_array($result))
{
echo "<td width=\"25%\"><font face=\"verdana\">" .
$row["city"] . "</font></td>";
echo "<td width=\"25%\"><font face=\"verdana\">" .
$row["arrival"] . "</font></td>";
echo "<td width=\"25%\"><font face=\"verdana\">" .
$row["departure"] . "</font></td>";
echo "<td width=\"25%\"><font face=\"verdana\">" .
$row["comment"]. "</font></td>";
$numero++;
}
echo "<tr><td colspan=\"15\"><font face=\"verdana\"><b>Número: " . $numero .
"</b></font></td></tr>";
mysql_free_result($result);
?>
y este es el ajax que utlizo previamente para insertar datos en la bd
Código HTML:
function objetoAjax(){ var xmlhttp=false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } return xmlhttp; } function save() { ajax=objetoAjax(); ajax.onreadystatechange=function() { if (ajax.readyState==4) { alert("se introdujo con exito en la base de datos"); ajax.open } } var cityvalue=encodeURIComponent(document.getElementById('city').value) var arrivalvalue=encodeURIComponent(document.getElementById('datepicker_value').value) var departurevalue=encodeURIComponent(document.getElementById('otrodatepicker_value').value) var commentvalue=encodeURIComponent(document.getElementById('comment').value) if(arrivalvalue>departurevalue) { alert('Day of arrival can not be after a day of departure'); } else if(departurevalue<arrivalvalue) { alert('Day of departure can not be until the arrival day'); } else{ ajax.open("GET", "addCity.php?city="+cityvalue+"&arrival="+arrivalvalue+"&departure="+departurevalue+"&comment="+commentvalue,true); ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); //enviando los valores ajax.send() document.getElementById('savecity').disabled = true; document.getElementById('more').disabled = true; document.getElementById('ciudad').value = "Select other city"; document.getElementById('add').disabled = false; document.getElementById('inner').style.display="block"; document.getElementById('datepicker_value').value=''; document.getElementById('otrodatepicker_value').value=''; document.getElementById('comment').value=''; } }