Printer Friendly Version
Email this thread to a friend
|
Featured Web Site Template |
|
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
omoutop
Joined: Feb 16, 2004
# Posts: 22
|
Posted: 07/08/2005 06:03 am
Hi to all!!!
I have the script presented below which returns the message:
Parse error: parse error, unexpected $ in ......../demo.php on line 1
I can not understand where is the fault and i have tried lots of things to locate it and fix it....
ANY SUGGESTIONS?
the paradox is that the fault is located in line 1 by the browser which means that either the fault is in line 1, or it is somewhere else and it cant be located by browser........confusing
<?
include "dbconnect.php";
$type = ($_REQUEST ['type']);
if (!$db_conn)
{
echo '<p> </p>';
echo '<p> </p>';
echo '<div align="center" class="greeka">An error has occured, Database can not be reached, please try again later. <p>';
echo '<p> </p>';
echo '<p> </p>';
}
else
{
// Set some variables for script
// To show each page by number set to Y. Set to N for prev-next links only
$showpages = "Y";
// Set number of records to be displayed per page $limit=somenumber
$limit=5;
if (empty($offset))
{
$offset=0;
}
$query = 'select * from Hotels '
."where type = '$type'";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
if ($numrows==0)
{
echo '<p> </p>';
echo '<p> </p>';
echo '<div align="center"> We are sorry, there is not any available record to display! </div>';
echo '<p> </p>';
echo '<p> </p>';
}
else
?>
<div align=center>
<strong><? echo $type ?></strong>
</div>
<?
echo '<p> </p>';
echo '<p> </p>';
{
$query = 'select * from Hotels '
."where type = '$type' limit $offset,$limit";
$result2 = mysql_query($query2);
while ($row=mysql_fetch_assoc($result2))
{
$ID = $row['ID'];
$name = $row['name'];
$hoteldescr = $row['hoteldescr'];
$location = $row['location'];
$town = $row['town'];
$url = "http://www.tzampa.gr/nikos/bestour/";
$url2 = "http://www.tzampa.gr/nikos/bestour/pictures/";
$querypicture = "select * from Gallery where HotelID = '$ID'";
$resultpicture = mysql_query($querypicture);
while ($rowpicture=mysql_fetch_assoc($resultpicture))
{
$picture = $rowpicture['picture'];
$descritpion = $rowpicture['descritpion'];
?>
<table width="73%" border="3" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr bgcolor="#FFFFFF">
<td width="21%" rowspan="2" bordercolor="#FFFFFF" bgcolor="#0d9aef"><div align="center"><img src="<? echo $url2 ?><? echo $picture ?>" alt="<? echo $descritpion ?>" width="150" height="113"></div></td>
<td width="43%" height="45" bordercolor="#FFFFFF"><div align="center">Location: <? echo $location ?> </div></td>
<td width="36%" bordercolor="#FFFFFF"><div align="center">Town: <? echo $town ?></div></td>
</tr>
<tr>
<td height="78" colspan="2" bordercolor="#0d9aef"><div align="justify"><? echo $hoteldescr ?></div></td>
</tr>
</table>
<?
};
};
//determine number of pages needed
$pages=intval($numrows/$limit);
//if number of records isn't evenly divisible by the number of pages above, add another page.
if ($numrows%$limit)
{
$pages++;
}
//set value of first record to be displayed
$first_record = $offset + 5;
echo "<br />";
//see if we're on the last page
if (!((($offset)/$limit)+1==$pages))
{
$last_record = $offset + $limit;
//is last page
echo " <strong>$last_record</strong> of <strong>$numrows</strong> $type(s). Click on image to view the $type <br />";
}
else
{
//is NOT last page - send this to browser
echo " <strong>$numrows</strong> of <strong>$numrows</strong> $type(s). Click on image to view the $type<br>";
}
echo "<br />n";
//prepare and display links to other results in browser
if ($offset != 0)
{
$prevoffset=$offset-$limit;
//create a previous link - if we're not on the first page
echo "<a class='nav' href='$PHP_SELF?offset=$prevoffset'><< Prev</a> n";
}
//construct that shows just prev-next or all page numbers
if ($showpages == Y)
{
if ( $pages != 1 )
{
for ($i=1;$i<=$pages;$i++)
{
$newoffset=$limit*($i-1);
if ( ((($offset)/$limit)==($i-1)) )
{
echo "$i n";
}
else
{
echo "<a class='nav' href='$PHP_SELF?offset=$newoffset'>$i</a> n";
}
}
}
}
if (!((($offset)/$limit)+1==$pages) && $pages!=1)
{
$newoffset=$offset+$limit;
//create a next link - if we're not on the last page
echo ("<a class='nav' href='$PHP_SELF?offset=$newoffset'>Next >></a><p>n" ;
}
}
else
{echo "No more $type(s) to display!";
}
}
?>
|
 |
lizardz
Joined: Nov 12, 2004
# Posts: 1394
|
Posted: 07/08/2005 10:50 am
The problem is in your dbconnect include file I think.
|
 |
vanachte
Joined: Feb 10, 2004
# Posts: 404
|
Posted: 07/08/2005 04:28 pm
I have no idea, but I like how the " " shows up in the code.
|
 |
You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- This is a private forum, for which you do not have permissions.
If you are a recent member, it's possible that you simply have not yet confirmed your account. Please
check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions
contained within.
If you cannot find this message, click here to Re-Send it.
|
If you are still experiencing problem, please read the
Login Assistance
Article for some advice on what may be causing your login not to work properly.
|
Switch to Advanced Editor and ...
Create a New Topic
or Reply to this Thread
|
|