943,914 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 78797
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 21st, 2006
0

Parse error: syntax error, unexpected T_STRING

Expand Post »
Hi

I am really struggling here and cant see the syntax error.

It is probably a " but could really do with a hand as to why I get the error:

unsxpected T_STRING on line 14

My php code is as follows:

[php]<?php

include_once("php/library/lib.php");
include_once("php/library/template.php");
include_once("php/library/database.php");


//
//$database = new database();//$security = new security();//$security->allowed_get("PHPSESSID");//$security->check_vars(false);//
$page = new template( "index.html" );
//$page->lockToLoggedIn = false;
//$security->set_counters(page);//$page->setRegionVisable("lines",true);// Build the actual page contents display
//$pageDtls = '<table cellpadding=0 cellspacing=0 border=0>';//$pageDtls .= '<tr><td>';//$pageDtls .= '<?region-start id="lines" type="repeat" ?>';//$pageDtls .= '<center>';//$pageDtls .= '<table class="browseContents" width="100%" border="0" cellspacing="0" cellpadding="1">';//$pageDtls .= '<tr>';
//$pageDtls = '<table cellpadding=0 cellspacing=0 border=0><tr><td><?region-start id="lines" type="repeat" ?><center><table class="browseContents" width="100%" border="0" cellspacing="0" cellpadding="1"><tr>';
//
//$img_width = 85;//$img_height = 30;
// Build a grid of ALL cells
//for ( $cat_set = 1 ; $cat_set < (MAX_CATS + 1); $cat_set ++ )//{// $categories = array();// $cat_hdrs = array();//
//// // Find all Categories for the current set//// $sqlQry = "SELECT *// FROM categories// WHERE cat_set_no = " . $cat_set . "// ORDER BY cat_pos_no";//
// $result = $database->runQuery( $sqlQry );// $rows = $database->numRows();//
// for ($a = 0 ; $a < $rows ; $a ++ )// {// $catObj = $database->getObject();//// $categories[$catObj->cat_pos_no -1] = $catObj->cat_id;// $cat_hdrs[$catObj->cat_pos_no -1] = $catObj->cat_name;// }////
// // Set the category headers//// for ( $cat_no = 0 ; $cat_no < 10; $cat_no ++ )// {// $pageDtls .= '<td id="hdrCell" valign="top">' . $cat_hdrs[$cat_no] . '</td>';// $pageDtls .= '<td id="spaceCell">&nbsp;</td>';// }////// $pageDtls .= '</tr>';// $pageDtls .= '<?repeat-line-start?>';//
// // Set Cell Details//
// for ( $line_no = 1 ; $line_no < (MAX_ROWS + 1); $line_no ++ )// {// $pageDtls .= '<tr>';//
// for ( $cat_no = 0 ; $cat_no < 10; $cat_no ++ )// {// $pageDtls .= '<td id="singleCell" valign="top">';//// $cellObj = $database->getSingleObject("SELECT *// FROM cells// WHERE cell_category = '" . $categories[$cat_no] . "'// AND cell_no = " . $line_no);//// if ($cellObj != null)// {// if ($cellObj->cell_status === "R")// {// $pageDtls .= '<a href="#">';// $pageDtls .= '<img src="/pages/images/img_reserved.png" width=' . $img_width . ' height=' . $img_height . ' border="1">';// }//
// if ($cellObj->cell_status === "S")// {// $pageDtls .= '<a href="' . $cellObj->cell_url . '">';// $pageDtls .= '<img src="/pages/sold/' . $cellObj->cell_image . '" width=' . $img_width . ' height=' . $img_height . ' border="1">';// }// }// else// {// $pageDtls .= '<a href="' . STORE_PATH . 'buy.php?category='. $categories[$cat_no] . '&cell=' . $line_no . '">';// $pageDtls .= '<img src="/pages/images/img_available.png" width=' . $img_width . ' height=' . $img_height . ' border="1">';// }//// $pageDtls .= '</a>';// $pageDtls .= '</td>';// $pageDtls .= '<td id="spaceCell">&nbsp;</td>';// }//// $pageDtls .= '</tr>';// }//}//
//unset($database);//
//$pageDtls .= '<?repeat-line-end?>';//$pageDtls .= '</table>';//$pageDtls .= '</center>';//$pageDtls .= '<?region-end?>';//$pageDtls .= '</td></tr>';//$pageDtls .= '</table>';//$page->setItem( "page-details" , $pageDtls );

// Display the page

echo $page->process();

?>[/php]

I am desperate for some help as I have been staring at this for a day or so.

all the best

Pete
Last edited by cscgal; Aug 22nd, 2006 at 8:51 pm. Reason: Added code tags
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pete harby is offline Offline
2 posts
since Aug 2006
Aug 21st, 2006
0

Re: Parse error: syntax error, unexpected T_STRING

First off please put your code inside of the php code tags
[php]Code here[/php]

The error is on line 14 but I can't really tell where line 14 starts in your code. Please either clean the code up a little or just give use lines 12-17 or something like that. Thanks
Team Colleague
Reputation Points: 36
Solved Threads: 2
PFO Founder
big_k105 is offline Offline
308 posts
since May 2003
Aug 21st, 2006
0

Re: Parse error: syntax error, unexpected T_STRING

[php]//$security->set_counters(page);//$page->setRegionVisable("lines",true);// Build the actual page contents display
//$pageDtls = '<table cellpadding=0 cellspacing=0 border=0>';//$pageDtls .= '<tr><td>';//$pageDtls .= '<?region-start id="lines" type="repeat" ?>';//$pageDtls .= '<center>';//$pageDtls .= '<table class="browseContents" width="100%" border="0" cellspacing="0" cellpadding="1">';//$pageDtls .= '<tr>';
//$pageDtls = '<table cellpadding=0 cellspacing=0 border=0><tr><td><?region-start id="lines" type="repeat" ?><center><table class="browseContents" width="100%" border="0" cellspacing="0" cellpadding="1"><tr>';
//
//$img_width = 85;//$img_height = 30;
// Build a grid of ALL cells[/php]


lines 12 - 17 as requested thanks for your help
Pete
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pete harby is offline Offline
2 posts
since Aug 2006
Aug 21st, 2006
0

Re: Parse error: syntax error, unexpected T_STRING

Well the error isn't in those lines because they are all commented out. The only thing I could see is that maybe the error is in one of the included files.
Team Colleague
Reputation Points: 36
Solved Threads: 2
PFO Founder
big_k105 is offline Offline
308 posts
since May 2003
Aug 23rd, 2006
0

Re: Parse error: syntax error, unexpected T_STRING

I can tell you that my personal experiences not T_STRING, as in your case, but T_INC came from not putting the "$" sign in front of a variable in a for loop. Check your syntax on your strings and your problem may be hidden somewhere in one of them...

It took me a lot of searching on the internet one day for something so simple. Then, after a some sleep, i woke up and saw the obvious mistake, corrected it, and the program worked perfectly.
Last edited by Woobag; Aug 23rd, 2006 at 11:34 pm.
Reputation Points: 10
Solved Threads: 0
Light Poster
Woobag is offline Offline
33 posts
since Jun 2006
Sep 11th, 2006
0

Re: Parse error: syntax error, unexpected T_STRING

do you notice the de color of the code chanched after

[PHP]
<?region-start id="lines" type="repeat" ?>
[/PHP]
the ?> tag closes the php sesion despate it being commened out by //

use of /* */ comment will solve this
Reputation Points: 32
Solved Threads: 41
Junior Poster
pzuurveen is offline Offline
196 posts
since Sep 2006
Sep 11th, 2006
0

Re: Parse error: syntax error, unexpected T_STRING

I just got Deja vu reading this thread. Twice I thought "I wrote that" and saw someone elses name. Am I having that much of an effect here? :-)
Reputation Points: 23
Solved Threads: 23
Posting Pro in Training
Puckdropper is offline Offline
494 posts
since Jul 2004
Dec 22nd, 2008
0

Re: Parse error: syntax error, unexpected T_STRING

I had this problem in Joomla! with my php code that I was including in an article through the plugin sourcerer. Well, needless to say, my web hosting changed to php 4 without me knowing why, I changed it to php 5 as the compiling engine and it worked like a charm.
Reputation Points: 53
Solved Threads: 33
Posting Whiz in Training
bugmenot is offline Offline
224 posts
since Nov 2006
Dec 22nd, 2008
0

Re: Parse error: syntax error, unexpected T_STRING

Click to Expand / Collapse  Quote originally posted by bugmenot ...
I had this problem in Joomla! with my php code that I was including in an article through the plugin sourcerer. Well, needless to say, my web hosting changed to php 4 without me knowing why, I changed it to php 5 as the compiling engine and it worked like a charm.
I'm pretty sure you just bumped a thread that was over 2 years old, that has to fit into the Daniweb drinking game if it exists.
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Dec 22nd, 2008
0

Re: Parse error: syntax error, unexpected T_STRING

Drink up buddy!!! funny
Reputation Points: 232
Solved Threads: 137
Practically a Master Poster
buddylee17 is offline Offline
665 posts
since Nov 2007
Message:
Previous Thread in PHP Forum Timeline: How to set hidden data
Next Thread in PHP Forum Timeline: nl2br() in PHP???





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC