473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

error in php code of PARSING ERROR

45
Hi everyone,

I have class and whenever i am running to this class it shows error like

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/sites/checkdemo.com/public_html/pathak/Paginated.php on line 7

i am giving the code please help me out its very urgent

Expand|Select|Wrap|Line Numbers
  1. <?
  2. include("PageLayout.php");
  3. class Paginated {
  4.     public $rs;                              //result set
  5.     public $pageSize;                      //number of records to display
  6.     public $pageNumber;                    //the page to be displayed
  7.     public $rowNumber;                     //the current row of data which must be less than the pageSize in keeping with the specified size
  8.     public $offSet;
  9.     public $layout;
  10.  
  11.     function __construct($obj, $displayRows = 1, $pageNum = 1) {
  12.         $this->setRs($obj);
  13.         $this->setPageSize($displayRows);
  14.         $this->assignPageNumber($pageNum);
  15.         $this->setRowNumber(0);
  16.         $this->setOffSet(($this->getPageNumber() - 1) * ($this->getPageSize()));
  17.     }
  18.  
  19.     //implement getters and setters
  20.     public function setOffSet($offSet) {
  21.         $this->offSet = $offSet;
  22.     }
  23.  
  24.     public function getOffSet() {
  25.         return $this->offSet;
  26.     }
  27.  
  28.  
  29.     public function getRs() {
  30.         return $this->rs;
  31.     }
  32.  
  33.     public function setRs($obj) {
  34.         $this->rs = $obj;
  35.     }
  36.  
  37.     public function getPageSize() {
  38.         return $this->pageSize;
  39.     }
  40.  
  41.     public function setPageSize($pages) {
  42.         $this->pageSize = $pages;
  43.     }
  44.  
  45.     //accessor and mutator for page numbers
  46.     public function getPageNumber() {
  47.         return $this->pageNumber;
  48.     }
  49.  
  50.     public function setPageNumber($number) {
  51.         $this->pageNumber = $number;
  52.     }
  53.  
  54.     //fetches the row number
  55.     public function getRowNumber() {
  56.         return $this->rowNumber;
  57.     }
  58.  
  59.     public function setRowNumber($number) {
  60.         $this->rowNumber = $number;
  61.     }
  62.  
  63.     public function fetchNumberPages() {
  64.         if (!$this->getRs()) {
  65.             return false;
  66.         }
  67.  
  68.         $pages = ceil(count($this->getRs()) / (float)$this->getPageSize());
  69.         return $pages;
  70.     }
  71.  
  72.     //sets the current page being viewed to the value of the parameter
  73.     public function assignPageNumber($page) {
  74.         if(($page <= 0) || ($page > $this->fetchNumberPages()) || ($page == "")) {
  75.             $this->setPageNumber(2);
  76.         }
  77.         else {
  78.             $this->setPageNumber($page);
  79.         }
  80.         //upon assigning the current page, move the cursor in the result set to (page number minus one) multiply by the page size
  81.         //example  (2 - 1) * 10
  82.     }
  83.  
  84.     public function fetchPagedRow() {
  85.         if((!$this->getRs()) || ($this->getRowNumber() >= $this->getPageSize())) {
  86.             return false;
  87.         }
  88.  
  89.         $this->setRowNumber($this->getRowNumber() + 1);
  90.         $index = $this->getOffSet();
  91.         $this->setOffSet($this->getOffSet() + 1);
  92.         return $this->rs[$index];
  93.     }
  94.  
  95.     public function isFirstPage() {
  96.         return ($this->getPageNumber() <= 2);
  97.     }
  98.  
  99.     public function isLastPage() {
  100.         return ($this->getPageNumber() >= $this->fetchNumberPages());
  101.     }
  102.  
  103.     /**
  104.      * <description>
  105.      * @return PageLayout <description>
  106.      */
  107.     public function getLayout() {
  108.         return $this->layout;
  109.     }
  110.  
  111.     /**
  112.      * <description>
  113.      * @param PageLayout <description>
  114.      */
  115.     public function setLayout(PageLayout $layout) {
  116.         $this->layout = $layout;
  117.     }
  118.  
  119.     //returns a string with the base navigation for the page
  120.     //if queryVars are to be added then the first parameter should be preceeded by a ampersand
  121.     public function fetchPagedNavigation($queryVars = "") {
  122.         return $this->getLayout()->fetchPagedLinks($this, $queryVars);
  123.     }//end writeNavigation
  124. }//end Paginated
  125. ?>
  126.  
Apr 23 '09 #1
3 1535
Markus
6,050 Expert 4TB
I don't see an error, and my debugger doesn't pick up an error.

What is in your layout file?
Apr 23 '09 #2
Markus
6,050 Expert 4TB
Hold the phone, are you using PHP4?
Apr 23 '09 #3
Dormilich
8,658 Expert Mod 8TB
out of curiousity, if you set your properties public, why using separate setter and getter methods?
Apr 23 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Andrew James | last post by:
Gentlemen, I'm running into a problem whilst testing the parsing of a language I've created with TPG . It seems that for some reason, TPG balks when I try to parse an expression whose first...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
2
by: Rashida | last post by:
Hi all! I have written a function to fetch lebels from xml file for cross-language interoperability. Please refer function code below. I am invoking itfrom my asp page saying...
1
by: D A H | last post by:
I have gotten the same exception in multiple projects. I have solved the underlying problem. My question is if anyone knew of a setting that would cause this exception to be thrown. A...
6
by: ST | last post by:
Hi, I keep getting the parser error, and I have no idea why. I've tried a number of things including: 1)building/rebuilding about 100x 2)making sure all dll's are in the bin folder in the root...
1
by: pbd22 | last post by:
hi. for some reason i am not able to navigate the dom. i keep getting the 'no properties' error but i think i am doing everything right. this is an XML response from an AJAX call. The ajax...
4
by: Chronictank | last post by:
Hi, as a bit of background (and seeing as it is my first post :)) i am a complete newbie at perl. I literally picked it up a week ago to do this project as it seemed like the best choice for a...
3
by: =?Utf-8?B?RGFuYQ==?= | last post by:
I am re-posting this message after registering my posting alias. When I specify an end tag for the clear element of namespaces in my web.config file, the parser error "Unrecognized element 'add'"...
3
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
1
by: hd95 | last post by:
In a perfect world my xml feed source would produce perfect xml ..that is not the case I am parsing an XML feed that sometimes has ampersands and dashes in the content that messes up my parsing. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.