I wanted something to tell people that visit my website when the last reservation was done, sort of like social sites. The script basically logs in into phpRES and copies the date and nationality of the last reservation and dumps it a text. THen is up to whatever CMS or type or website you are using for your hotel to show it. I use Joomla and i just dumped into a module.
You can see it live in www.bluealmondhostel.com (top right corner)
Create a file WHATEVER.PHP
copy the code below
Code: Select all
<?php
//CONNECT TO DATABASE
$link = @mysql_connect('SERVER', 'USERNAME', 'PASSWORD') or die(mysql_error());
$select = @mysql_select_db('DATABASE') or die(mysql_error());
//RETRIEVE FIRST ENTRY
$result = @mysql_query('SELECT res_prenota2011.datainserimento, res_clienti.nazionalita, res_clienti.idclienti, res_prenota2011.idclienti FROM res_prenota2011, res_clienti WHERE res_clienti.idclienti = res_prenota2011.idclienti ORDER BY `res_prenota2011`.`datainserimento` DESC LIMIT 1,1') or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
echo "Last reservation was made on {$row['datainserimento']} from {$row['nazionalita']}
";
echo $row['post'];
}
@mysql_free_result($result);
//CLOSE DATABASE
@mysql_close($link);
?>