unexpected T_IF Issues
Posted: Wed Jul 04, 2007 4:53 am
Hi guys/girls,
I'm tyring to construct an IF ELSE statement, but i keep on getting the following error message
Which is this bit of code,
All help apperciated, thanks
Here is the rest of the code:
I'm tyring to construct an IF ELSE statement, but i keep on getting the following error message
Parse error: syntax error, unexpected T_IF in on line 116
Which is this bit of code,
Code: Select all
echo '<td>'.if($row['Confirmed' ] > 0) { echo "<a href="roomdetails.php?HotelRoomID=' . $row['HotelRoomID'] . '">More information on hotel room</a>" }else{.'<input type="checkbox" name="HotelRoomID[]" value="' . $row['HotelRoomID'] . '" />Select ' . $row['RoomType'] .' to update</td>';Here is the rest of the code:
Code: Select all
<?PHP
extract($_GET);
$daterep = str_replace("/","-",$datefrom);
$datereps = str_replace("/","-",$dateto);
$newdate = date ("d M Y", strtotime ($daterep));
$newdates = date ("d M Y", strtotime ($datereps));
setcookie("from", $newdate, time( )+600);
setcookie("to", $newdates, time( )+600);
setcookie("hotel", $subcat, time( )+600);
?>
<?PHP include 'opendb.php'; ?>
<?PHP include 'header.php'; ?>
<?php
if(isset($_GET))
{
extract($_GET);
$optionsheld = $_GET['optionsheld'];
$confirmedroom = $_GET['confirmedroom'];
$cat = $_GET['cat'];
$Season = $_GET['Season'];
$query = mssql_init ("sp_SearchRooms");
mssql_bind($query, "@DateTo", $newdate, SQLVARCHAR);
mssql_bind($query, "@Season", $Season, SQLVARCHAR);
mssql_bind($query, "@resortID", $cat, SQLINT2);
mssql_bind($query, "@DateFrom", $newdates, SQLVARCHAR);
mssql_bind($query, "@HotelID", $subcat, SQLVARCHAR);
mssql_bind($query, "@SearchConfirmed", $groupname, SQLVARCHAR);
mssql_bind($query, "@SearchOptions", $optionsheld, SQLVARCHAR);
//mssql_bind($query1, "RETVAL", &$HotelRoomID2, SQLINT2);
if (($result = mssql_execute($query)) === false)
{
die('Could not execute the query ' . $sql );
}
//$held = "1";
//$que = mssql_init ("sp_SearchByName");
//mssql_bind($query, "@ClientName ", $optionsname, SQLVARCHAR);
//mssql_bind($query, "@UserName", $username, SQLVARCHAR);
//mssql_bind($query, "@SearchOptionsHeldByMe", $held, SQLINT2);
//if (($res = mssql_execute($que)) === false)
//{
// die('Could not execute the query ' . $sql );
//}
?>
<?PHP
$count=mssql_num_rows($result);
//$count=mssql_num_rows($res);
if ($count == 0)
{
echo "<p>Sorry, your search returned no results</p><br><input type='button' value='Retry' onClick='history.go(-1)'>";
} else {
?>
<form action="roomhold.php" method="get">
<table width="108%" border="0">
<tr>
<td width="19%"></td>
<td width="8%"><strong>Hotel name:</strong></td>
<td width="8%"><strong>Room Type:</strong></td>
<td width="8%"><strong>Available From:</strong></td>
<td width="8%"><strong>Available To:</strong></td>
<td width="9%"><strong>Requested from</strong></td>
<td width="9%"><strong>Requested To:</strong></td>
<td width="5%"><strong>Notes</strong></td>
<td width="44%"> </td>
</tr>
<?php
while ($row = mssql_fetch_array($result))
{
echo '<tr>';
echo '<td><a href="roomdetails.php?HotelRoomID=' . $row['HotelRoomID'] . '">More information on hotel room</a></td>';
echo '<td>' . $row['HotelName' ] . '</td>';
echo '<td>' . $row['RoomType' ] . '</td>';
echo '<td>' . $row['AvailableFrom' ] . '</td>';
echo '<td>' . $row['AvailableTo' ] . '</td>';
echo '<td><input type="hidden" name="datefrom" value="' . $datefrom . '" />' . $datefrom .'</td>';
echo '<td><input type="hidden" name="dateto" value="' . $dateto . '" />' . $dateto .'</td>';
echo '<td>' . $row['Notes' ] . '</td>';
echo '<td>'.if($row['Confirmed' ] > 0) { echo "<a href="roomdetails.php?HotelRoomID=' . $row['HotelRoomID'] . '">More information on hotel room</a>" }else{.'<input type="checkbox" name="HotelRoomID[]" value="' . $row['HotelRoomID'] . '" />Select ' . $row['RoomType'] .' to update</td>';
echo '</tr>';
}
}
?>
<tr>
<td colspan="7"><input type="Submit" value="Hold Room"> <input type='button' value='Back' onClick='history.go(-1)'>
<INPUT name="button" type="button" onClick="location.href='http://pb-sql/admin.php'" value="Cancel">
</td>
</tr>
</table>
</form>
<?PHP include 'footer.php'; ?>
<?PHP }}
?>Code: Select all