Bonjour,
je veux faire la mise à jour de la base de donnée je fait echo pour afficher toute les données après faire update de la table mais s'afficher juste availability
- From: 2010-12-28 - To: 2010-12-28 - Quantity: 1 et le reste non je sais pas pourquoi voir mon code :
et le fichier XML :
merci de vous réponse
je veux faire la mise à jour de la base de donnée je fait echo pour afficher toute les données après faire update de la table mais s'afficher juste availability
- From: 2010-12-28 - To: 2010-12-28 - Quantity: 1 et le reste non je sais pas pourquoi voir mon code :
$message = new SimpleXMLElement($fluxXml);
//------------------- EXEMPLE EXTRAIRE login&pass--------------------------------------
echo '<strong>availability</strong><br>';
foreach ($message->authentication as $character) {
echo '- login: '.$character['login'].' - Pass: '.$character['password'].'<br>';
}
include_once 'connect.php';
mysql_select_db($dbname, $conn);
$sqlp ="SELECT jo_jomres_partenaire.login, jo_jomres_partenaire.pass
FROM jo_jomres_partenaire ";
$req = mysql_query($sqlp)or die(mysql_error());
$datalog = mysql_fetch_assoc($req);
if($datalog['login']=$character['login'] and ($datalog['pass']=$character['password'])) {
echo '<strong>Bon test login & pass</strong><br>';
}
//------------------- EXEMPLE EXTRAIRE hotelID -----------------------------------------------
echo '<strong>hotelID</strong><br>';
foreach ($message->inventoryUpdate as $character) {
$hotelid=$character['hotelId'];
echo '- hotel Id: '.$character['hotelId'].' <br>';
}
//------------------- EXEMPLE EXTRAIRE room ID -----------------------------------------------
echo '<strong>room ID</strong><br>';
foreach ($message->inventoryUpdate->room as $rooms) {
$chid=$rooms['id'];
echo '- room Id: '.$rooms['id'].' <br>';
//------------------- EXEMPLE EXTRAIRE availability -----------------------------------------------
echo '<strong>availability</strong><br>';
foreach($rooms->inventory->availability as $character) {
echo '- From: '.$character['from'].' - To: '.$character['to'].' - Quantity: '.$character['quantity'].'<br>';
$qte=$character['quantity'];
$from=$character['from'];
$to=$character['to'];
list($y,$m,$d)=explode('-',$from);
list($yt,$mt,$dt)=explode('-',$to);
$timefrom=mktime(0,0,0,$m,$d,$y);
$timeto=mktime(0,0,0,$mt,$dt,$yt);
$xtable='jo_jomres_schedule_'.$hotelid;
echo 'xtable';
for($ii=$timefrom;$ii<=$timeto;$ii+=86400){
$dateam=date('Y-m-d',$ii);
//Condition Si Existe dans la base de donnees
$res=mysql_query("select * from ".$xtable." WHERE room_uid = ".$chid." and jour = '".$dateam."'") or die("<br/><br/>".mysql_error());
if(mysql_num_rows($res) == 1){
//SI Resultat OUI : METTRE UPDATE
//mysql_query("UPDATE ".$xtable." SET jour = '".$dateam."', nbr_dispo= ".$qte." WHERE room_uid = ".$chid." and jour = '".$dateam."'");
}
//SI Resultat NON : INSERTION
//if(mysql_num_rows($res) == 0){
// mysql_query("Insert ...");
//}
}
//------------------- EXEMPLE EXTRAIRE RATE -----------------------------------------------
foreach ($rooms->rate as $rates) {
switch((string) $rates['rateName']) {
case 'Best Available Rate':
echo '- currency '.$rates['currency'].' - rateCode: '.$rates['rateCode'].' - rateName: '.$rates['rateName'].'<br>';
echo $rates, '<br> <strong>Best Available Rate</strong>';
foreach ($rates->planning as $character) {
echo '<br>- From: '.$character['from'].' - To: '.$character['to'].' - minimumStay: '.$character['minimumStay'].'- unitPrice: '.$character['unitPrice'].'- noArrival: '.$character['noArrival'].'<br>';
}
break;
case 'Package Offer':
echo '- currency '.$rates['currency'].' - rateCode: '.$rates['rateCode'].' - rateName: '.$rates['rateName'].'<br>';
echo $rates, '<br> <strong>Package Offer</strong>';
foreach ($rates->planning as $character) {
echo '<br>- From: '.$character['from'].' - To: '.$character['to'].' - minimumStay: '.$character['minimumStay'].'- unitPrice: '.$character['unitPrice'].'- noArrival: '.$character['noArrival'].'<br>';
}
break;
case 'Public Price':
echo '- currency '.$rates['currency'].' - rateCode: '.$rates['rateCode'].' - rateName: '.$rates['rateName'].'<br>';
echo $rates, '<br> <strong>Public Price</strong>';
foreach ($rates->planning as $character) {
echo '<br>- From: '.$character['from'].' - To: '.$character['to'].' - minimumStay: '.$character['minimumStay'].'- unitPrice: '.$character['unitPrice'].'- noArrival: '.$character['noArrival'].'<br>';
}
break;
}
}
}
}
et le fichier XML :
<message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<authentication login="Availpro" password="admin" />
<inventoryUpdate hotelId="4">
<room id="B3T">
<inventory>
<availability from="2010-12-28" to="2010-12-28" quantity="1" />
<availability from="2010-12-29" to="2010-12-31" quantity="1" />
<availability from="2011-01-01" to="2011-01-01" quantity="1" />
<availability from="2011-01-02" to="2011-03-31" quantity="1" />
<availability from="2011-04-01" to="2011-12-30" quantity="1" />
</inventory>
<rate currency="EUR" rateCode="BAR" rateName="Best Available Rate">
<planning from="2010-12-28" to="2010-12-15" minimumStay="1" unitPrice="210"
noArrival="false" isClosed="false" />
<planning from="2010-12-29" to="2010-12-31" minimumStay="1" unitPrice="273"
noArrival="false" isClosed="false" />
<planning from="2011-01-01" to="2011-01-01" minimumStay="1"
unitPrice="340.0000" noArrival="false" isClosed="false" />
<planning from="2011-01-02" to="2011-03-31" minimumStay="1" unitPrice="294"
noArrival="false" isClosed="false" />
<planning from="2011-04-01" to="2011-12-30" minimumStay="1"
unitPrice="340.0000" noArrival="false" isClosed="false" />
</rate>
<rate currency="EUR" rateCode="PACKAGE1" rateName="Package Offer">
<planning from="2010-12-28" to="2010-12-16" minimumStay="1"
unitPrice="380.0000" noArrival="false" isClosed="false" />
<planning from="2010-12-29" to="2010-12-31" minimumStay="1"
unitPrice="380.0000" noArrival="false" isClosed="false" />
<planning from="2011-01-01" to="2011-01-01" minimumStay="1" unitPrice="357"
noArrival="false" isClosed="false" />
<planning from="2011-01-02" to="2011-03-31" minimumStay="1"
unitPrice="340.0000" noArrival="false" isClosed="false" />
<planning from="2011-04-01" to="2011-12-30" minimumStay="1"
unitPrice="340.0000" noArrival="false" isClosed="false" />
</rate>
<rate currency="EUR" rateCode="RACKPRI" rateName="Public Price">
<planning from="2010-12-28" to="2010-12-17" minimumStay="1"
unitPrice="380.0000" noArrival="false" isClosed="false" />
<planning from="2010-12-29" to="2010-12-31" minimumStay="1"
unitPrice="380.0000" noArrival="false" isClosed="false" />
<planning from="2011-01-01" to="2011-01-01" minimumStay="1"
unitPrice="340.0000" noArrival="false" isClosed="false" />
<planning from="2011-01-02" to="2011-03-31" minimumStay="1"
unitPrice="340.0000" noArrival="false" isClosed="false" />
<planning from="2011-04-01" to="2011-12-30" minimumStay="1"
unitPrice="340.0000" noArrival="false" isClosed="false" />
</rate>
</room>
</inventoryUpdate>
</message>
merci de vous réponse