TinyPortal

Development => Support => Topic started by: DJ Skott on April 11, 2008, 10:35:50 PM

Title: Parse error: syntax error, unexpected '}'
Post by: DJ Skott on April 11, 2008, 10:35:50 PM
im getting

Parse error: syntax error, unexpected '}' in /home/xxxx/public_html/xxxx/board/Sources/Load.php(1743) : eval()'d code(35) : eval()'d code on line 1


when trying to use this code in a PHPBlock


<? require("configreq.php");

$stamp = mktime(0,0,0,date('m')-$requestdays,date('d'),date('Y'));
$now = date('Y-m-d H:i:s',$stamp);

//Handle different types of databases' special needs
switch($db->login["Type"])
{
  case "ibase" : $orderby = "ORDER BY count(songlist.ID) DESC"; break;
  case "mysql" :
  default      : $orderby = "ORDER BY cnt DESC"; break;
}
 
$now = $db->FormatTimestamp($now);
$db->open("SELECT songlist.ID, songlist.title, songlist.artist, count(songlist.ID) as cnt
            FROM requestlist, songlist
WHERE   (requestlist.songID = songlist.ID) AND
        (requestlist.code=200) AND
(requestlist.t_stamp>=$now)
GROUP BY songlist.ID, songlist.artist, songlist.title
$orderby",10);

if($db->num_rows()>0)
{


function PutRow($song)
{
global $i;
Preparesong($song);


?>

     <font size="2" color="#003366"><small><? echo $i; ?>.
     <a href="javascript:songinfo(<? echo $song["songid"]; ?>)"><? echo $song["artist"]; ?></a></small></font> <font size="2" color="#9F9F9F"><small>(<? echo $song["cnt"]; ?>)</small></font><br>
<font size="2" color="#003366"><small>&nbsp;&nbsp;&nbsp;&nbsp;<? echo $song["title"]; ?></small></font><br>
   
<?}?>

<table width="100%" bgcolor="<? echo $lightrow; ?>" border="0" cellspacing="0" cellpadding="5">
<tr bgcolor="<? echo $darkrow; ?>"><td nowrap><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#555555">Top10 Requests</font></b></td></tr>
<tr><td nowrap>
<?
$i=0;
while($song = $db->row())
{
   $i++;
   PutRow($song);
}
?> 
</td></tr>
</table>
<br>
<?}?>



Any ideas why its failing?
Title: Re: Parse error: syntax error, unexpected '}'
Post by: JPDeni on April 11, 2008, 10:52:26 PM
I know 100% why it's failing. When you use a php block or php article, you can't use the


<?


at the beginng and the


?>


at the end.

Title: Re: Parse error: syntax error, unexpected '}'
Post by: DJ Skott on April 11, 2008, 11:10:53 PM
I did that. sorry cut the code from the wrong screen.
Title: Re: Parse error: syntax error, unexpected '}'
Post by: JPDeni on April 11, 2008, 11:19:59 PM
Then post the code you're using and I'll see if I can figure it out.

Personally, I find it easier to debug code that is pure php and doesn't have html mixed in, but I'll give it a try.
Title: Re: Parse error: syntax error, unexpected '}'
Post by: DJ Skott on April 11, 2008, 11:21:49 PM
i actually got it, it was the way it was cutting and pasting now im in the midst of hacking code to match the proper directories. thanks for the look tho.