Code: Select all
<?PHP include 'opendb.php'; ?>
<?PHP include 'header.php'; ?>
<?php
extract($_GET);
$datefrom= $_GET['$datefrom'];
$dateto= $_GET['$dateto'];
// This checks for querystring vars called DateHeld and UserName. If they are
// present, then the if gets executed. If not, then the $DateHeld and $UserName
// vars are unset/undefined
if( isset($_GET['DateHeld'], $_GET['UserName']) )
{
$DateHelds= $_GET['DateHeld'];
$UserNames= $_GET['UserName'];
}
$UserNames = $_GET['UserName'];
$forename = $_GET['forename'];
$daterep = str_replace("/","-",$datefrom);
$datereps = str_replace("/","-",$dateto);
$dat = str_replace("/","-",$DateHelds);
$dateheld = str_replace("/","-",date("d/m/Y"));
$newdate = date ("d M Y", strtotime ($daterep));
$newdates = date ("d M Y", strtotime ($datereps));
$newheld = date ("d M Y", strtotime ($dat));
$optionheld = date ("d M Y", strtotime ($dateheld));
$query = mssql_init ("sp_insertClientDetails");
mssql_bind($query, "@Surname", $surname, SQLVARCHAR);
mssql_bind($query, "@UserID", $UserNames, SQLVARCHAR);
mssql_bind($query, "@DateHeld", $optionheld, SQLVARCHAR);
mssql_bind($query, "@ForeName", $forename, SQLVARCHAR);
mssql_bind($query, "RETVAL", &$ClientDetailID, SQLINT2);
if (($result = mssql_execute($query)) === false)
{
die('Could not execute the query query 2(Insert client)');
}
if(isset($_GET['HotelRoomID']))
{
foreach($_GET['HotelRoomID'] as $k=>$k1)
{
//----Query 5------
///--------------------------------------------
$quess = mssql_init ("sp_SearchHeldRooms");
mssql_bind($quess, "@HotelRoomID", $k1, SQLINT2);
mssql_bind($quess, "@AvailableFrom",$newdate, SQLVARCHAR);
mssql_bind($quess, "RETVAL", &$RoomDateIDs, SQLINT2);
if (($rep = mssql_execute($quess)) == false)
{
die('Could not execute the query query 5');
//---------------------------------------------------
} else {
if($RoomDateIDs > 0) {
//---query 2---------------------
$qos = mssql_init ("sp_insertOptionRoom");
mssql_bind($qos, "@RoomDateID", $RoomDateIDs, SQLINT2);
mssql_bind($qos, "@ClientDetailID", $ClientDetailID, SQLINT2);
mssql_bind($qos, "@UserName", $UserNames, SQLVARCHAR);
mssql_bind($qos, "RETVAL", &$OptionRequestID[], SQLINT2);
//mssql_execute($qos);
if (($reson = mssql_execute($qos)) === false)
{
die('Could not execute the query query 4(Option request)');
}
} elseif($RoomDateIDs == "") {
//----Query 3------
$query2 = mssql_init ("sp_HoldRoom");
mssql_bind($query2, "@HotelRoomID", $k1, SQLINT2);
mssql_bind($query2, "@ClientDetailID", $ClientDetailID, SQLINT2);
mssql_bind($query2, "@AvailableFrom",$newdate, SQLVARCHAR);
mssql_bind($query2, "@AvailableTo", $newdates, SQLVARCHAR);
mssql_bind($query2, "@UserName", $UserNames , SQLVARCHAR);
mssql_bind($query2, "RETVAL", $RoomDateID, SQLINT2);
if (($reso = mssql_execute($query2)) == false)
{
die('Could not execute the query query 3(Hold room)'.$query2);
}
// if(isset($RoomDateID) < 1)
//{echo ""; } else {
//foreach($RoomDateID as $heldroomsrequest)
{The problem starts when i want to output the data i just inputted into the database. What happens is when sometimes it out puts the results and other times it says no results where inputted. As show below is where the data just entered is selected and outputted:
Code: Select all
$holdselect = mssql_init ("sp_selectheldrooms");
mssql_bind($holdselect, "@RoomDateID", $RoomDateID, SQLINT2);
if (($resultheld = mssql_execute($holdselect)) == false)
{
die('Could not execute the query query 3(Hold room select)'.$holdselect);
}
}
$count=mssql_num_rows($resultheld);
//}
}
}
{
}
}
}
//-------- Result Set (Held Rooms)-----------
//--------------Result Set(option request)-------
//if(isset($OptionRequestID) < 1)
//{echo ""; } else {
//foreach($OptionRequestID as $optionrequest)
// {
//
// $optionselect = mssql_init ("sp_selectoptionrequest");
// mssql_bind($optionselect, "@OptionRequestID", $optionrequest, SQLINT2);
// if (($resultoption = mssql_execute($optionselect)) == false)
// {
// die('Could not execute the query query 3(Option request select)'.$optionselect);
// }
//}
//$counts=mssql_num_rows($resultoption);
// }
?>
<p><font size="+2">The following have either been held on option or been held.</font></p>
<P>
<form action="holdcheck.php" method="get">
<table width=693 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=89></td>
<td width=88></td>
<td width=110></td>
<td width=96></td>
<td width=122></td>
<td width=94></td>
<td width=94></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?PHP
if ($count == 0)
{
echo "<p><br><font size=+2>You have not held any rooms, but if you have made an option request, then the request has gone through.
</p></font><p><input name=button22 type=button onClick=location.href='http://pb-sql/wintersearch.php' value=Back to search>";
}else {
?>
<tr>
<td colspan="7"><strong><font color="#FF0000" size="7">Rooms held</font></strong></td>
</tr>
<tr>
<td bgcolor="#FFFF00"><strong>Hotel name</strong></td>
<td bgcolor="#FFFF00"><strong>First name</strong></td>
<td bgcolor="#FFFF00"><strong>Surname</strong></td>
<td bgcolor="#FFFF00"><strong>Room type</strong></td>
<td bgcolor="#FFFF00"><strong>Available From</strong></td>
<td bgcolor="#FFFF00"><strong>Available To</strong></td>
<td bgcolor="#FFFF00"> </td>
</tr>
<tr>
<?php
while ($row=mssql_fetch_array($resultheld))
{
echo '<td bgcolor="#FFFF00" ><input name="HotelName" type="hidden" value="'.$row['HotelName'].'">' . $row['HotelName' ] . '<input name="HotelRoomID" type="hidden" value="'.$row['HotelRoomID'].'"></td>';
echo '<td bgcolor="#FFFF00">' . $row['Forename' ] . '<input name="ResortID" type="hidden" value="'.$row['ResortID'].'"></td>';
echo '<td bgcolor="#FFFF00">' . $row['Surname' ] . '</td>';
echo '<td bgcolor="#FFFF00">' . $row['RoomType' ] . '<input name="Surname" type="hidden" value="'.$row['Surname'].'"></td>';
echo '<td bgcolor="#FFFF00"><input name="AvailableFrom" type="hidden" value="'.$row['AvailableFrom'].'">' . $row['AvailableFrom' ] . '</td>';
echo '<td bgcolor="#FFFF00"><input name="AvailableTo" type="hidden" value="'.$row['AvailableTo'].'">' . $row['AvailableTo' ] . '<input name="ClientDetailID" type="hidden" value="'.$row['ClientDetailID'].'"></td>';
echo '<td bgcolor="#FFFF00"><input type="radio" name="RoomDateID" value="' . $row['RoomDateID'] . '" />Select ' . $row['HotelName'] .' to update </td>';
}
?>
<td colspan="7"> </td>
</tr>
<tr>
<td colspan="7"> <input name="Confirm" type="submit" value="Confirm"> <input name="flights" type="submit" value="Check for flights">
</td>
</tr>
</table>
</form> <?PHP } ?>
<?PHP
mssql_close()
?>
<?PHP include 'footer.php'; ?>Code: Select all
if ($count == 0)
{
echo "<p><br><font size=+2>You have not held any rooms, but if you have made an option request, then the request has gone through.
</p></font><p><input name=button22 type=button onClick=location.href='http://pb-sql/wintersearch.php' value=Back to search>";
}else {
?>