/    Sign up×
Community /Pin to ProfileBookmark

T_String problem

Hello, im trying to get information out of my database, and creating a page numbering so if there is more then X results but im getting “Parse error: syntax error, unexpected T_STRING in /folder/index.php on line 97” can someone please help me to find out why this aint working ? :/

[code=php]<?

require_once(“config.php”);

?>

<?php

//This checks to see if there is a page number. If not, it will set it to page 1
if (!(isset($pagenum)))
{
$pagenum = 1;
}

if($rows==0)
{
echo “<center>nothing was found</center>”;
}else{

//This tells us the page number of our last page
$last = ceil($rows/$page_rows);
?>

//this makes sure the page number isn’t below one, or more than our maximum pages
if ($pagenum < 1)
{
$pagenum = 1;
}
elseif ($pagenum > $last)
{
$pagenum = $last;
}

// This shows the user what page they are on, and the total number of pages

$max = $page_rows * ($pagenum – 1);

//this makes sure the page number isn’t below one, or more than our maximum pages
if ($pagenum < 1)
{
$pagenum = 1;
}

echo ” –Page $pagenum of $last– <p>”;

if ($pagenum == 1)
{
}
else
{
echo “<a href='{$_SERVER[‘PHP_SELF’]}?pagenum=1}’><<-First”;
echo ” “;
$previous = $pagenum-1;
echo “<a href='{$_SERVER[‘PHP_SELF’]}?pagenum=$previous}’><- Previous”;
}

//just a spacer
echo ” — “;

if ($pagenum == $last)
{
}
else {
$next = $pagenum+1;
echo “<a href='{$_SERVER[‘PHP_SELF’]}?pagenum=$next}’>Next -></a>”;
echo ” “;
echo “<a href='{$_SERVER[‘PHP_SELF’]}?pagenum=$last}’>Last ->></a>”;
}

?>

<br>
<br>
<!– BEGIN show_site_ads –>

<!– END show_site_ads –>
<br>

<?
$max = ‘limit ‘ .($pagenum – 1) * $page_rows .’,’ .$page_rows;
//echo $max;

$result = (SELECT * FROM flash order by DATE”);
$count = mysql_result($result, 0);
$page = 1;
$limit = 30;

if(isset($_GET[‘page’]) && $_GET[‘page’] >= 1 && $_GET[‘page’] <= ($count / $limit)) {
$page = (int)$_GET[‘page’];
}

$offset = $limit * ($page – 1);

$query = “SELECT * FROM flash order by DATE”;
$result = mysql_query($query);

if(!$result) {
echo “Error with query”;
exit;
}

$temp = array();
$i=0;
while($row = mysql_fetch_array($result)) {
$temp[$i][0]=$row[‘name’];
$i++;
}

$z=0;

echo “<table border=’0′ cellpadding=’5′>”;
for($x=0;$x<ceil($i/5);$x++)
{
echo “<tr>”;
for($y=0;$y<$image_per_row;$y++){
echo “<td>”;
if(empty($temp[$z][0]))
{
echo “&nbsp;”;
}
else{
echo ‘<center><a href=”/<? echo $temp[$z][0] target=”_blank”; ?>”><? echo $temp[$z][0]; ?></a>

<br></center>’;
}
echo “</td>”;
$z++;
}
echo “</tr>”;
}
echo “</table>”;
}
echo “<title>Title</title>”;
?>
<!– BEGIN show_site_ads –>

<!– END show_site_ads –>
<div style=”clear:both”>
</div>

<?
include “footer2.php”;
?>[/code]

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@Rubbish_ManSep 13.2009 — What line is line 97?
Copy linkTweet thisAlerts:
@mangekyoauthorSep 13.2009 — What line is line 97?[/QUOTE]

"$query = "SELECT * FROM flash order by DATE"; " is on that line.
Copy linkTweet thisAlerts:
@Rubbish_ManSep 13.2009 — I think it may be the " in the line
[code=php]
$result = (SELECT * FROM flash order by DATE");
[/code]
Copy linkTweet thisAlerts:
@mangekyoauthorSep 15.2009 — I think it may be the " in the line
[code=php]
$result = (SELECT * FROM flash order by DATE");
[/code]
[/QUOTE]


it was not ? i removed it and it's still the same error.
Copy linkTweet thisAlerts:
@criterion9Sep 15.2009 — Did you mean to close your php tag and continue to output php code?

$last = ceil($rows/$page_rows);

?>

//this makes sure the page number isn't below one, or more than our maximum pages

if ($pagenum < 1)
[/quote]
Copy linkTweet thisAlerts:
@aj_nscSep 15.2009 — [code=php]
$result = (SELECT * FROM flash order by DATE");
[/code]


The line above (several lines above 97) is the problem (as Rubbish_Man previously pointed out). I think you must've meant:

[code=php]
$result = mysql_query("SELECT * FROM flash order by DATE");
[/code]


EDIT:

Not to mention this problem:

[code=php]
echo '<center><a href="/<? echo $temp[$z][0] target="_blank"; ?>"><? echo $temp[$z][0]; ?></a>
[/code]


You are echoing out a statement and then you use php tags <? ?> even though this statement is already being parsed by the PHP parser, and you don't close your echo statement with a ';

As well as the errors criterion pointed out above - lots and lots of errors in this code, fixing one undoubtedly leads to another error being displayed - don't be fooled into thinking that because an error message is still being displayed, you didn't fix one of the (many) errors in your code.
×

Success!

Help @mangekyo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...