cyber_alchemist Posted October 4, 2013 Share Posted October 4, 2013 I wrote this at the end of all the function in a class but then why i am getting a parse error of "?>" ??? public function international_list_display() { $international_categories = $_GET['international_categories']; $query = 'SELECT * FROM tourDB WHERE categories = "$international_categories"'; $result = mysql_query( $query ) or die ( mysql_error() ); if ( $result !== false && mysql_num_rows($result) > 0 ) { while ( $ilist = mysql_num_rows( $result ) > 0) { $tour_id = stripslashes( $ilist[ 'tour_id' ] ); $tour_type = stripslashes( $ilist[ 'tour_type' ] ); $tour_name = stripslashes( $ilist[ 'tour_name' ] ); $day = stripslashes( $ilist[ 'day' ] ); $nights = stripslashes( $ilist[ 'nights' ] ); $tour_price = stripslashes( $ilist[ 'tour_price' ] ); $overview = stripslashes( $ilist[ 'overview' ] ); $itinerary = stripslashes( $ilist[ 'itinerary' ] ); $terms_conditons = stripslashes( $ilist[ 'terms_conditons' ] ); $inclusions = stripslashes( $ilist[ 'inclusions' ] ); $exclusions = stripslashes( $ilist[ 'exclusions' ] ); $twin_triple_sharing = stripslashes( $ilist[ 'twin_triple_sharing' ] ); $single_occcupancy = stripslashes( $ilist[ 'single_occcupancy' ] ); $child_with_no_bed = stripslashes( $ilist[ 'child_with_no_bed' ] ); $inf_below = stripslashes( $ilist[ 'inf_below' ] ); $pricing_details = stripslashes( $ilist[ 'pricing_details' ] ); $url = stripslashes( $ilist[ 'url' ] ); $international_list_cat .= <<<INTERNATIONAL_LIST_CAT <div class="domestic-tours"> <ul> <li><a href="#overview_$url">Overview</a></li> <li><a href="#itinerary_$url">Itinerary</a></li> <li><a href="#inclusions_$url">Inclusions</a></li> <li><a href="#terms_$url">Terms And Conditions</a></li> <li><a href="#price_$url">Tour Price</a></li> </ul> <div id="overview_$url"> <!-- <div id="dest-thumb-nail" class="dest-thumb-nail"> <ul class="bjqs"> <li><img src="img/bangkok/1.jpg" /></li> <li><img src="img/bangkok/2.jpg" /></li> <li><img src="img/bangkok/3.jpg" /></li> <li><img src="img/bangkok/4.jpg" /></li> <li><img src="img/bangkok/5.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> </ul> </div> --> <div class="overview"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights , $day Days</span><br /><br /> $overview </div> </div> <div id="itinerary_$url"> <div class="itin-content"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights, $day Days</span><br /><br /><br /> $itinerary </div> </div> <div id="inclusions_$url"> <div class="inclusions-exclusions"> <span class="inclusions">Inclusions</span><br /><br /> $inclusions <br /> <br /> <span class="exclusions">Exclusions</span><br /><br /> $exclusions <br /> <br /> </div> </div> <div id="terms_$url"> <div class="terms" > <span class="terms-and-conditions" >Terms And Conditions </span><br /><br /> $terms_conditons </div> </div> <div id="price_$url"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> $twin_triple_sharing </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> $single_occcupancy </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> $child_with_no_bed </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price=tab-element" > FREE </div> </div> <button id="book-now">Book Now !</button> <button id="call" >call your travel expert</button> </div> </div> </div> <div class="price-tag-domestic"><span class="pricy-price" >` $tour_price</span></div> <div class="cleaner"></div> INTERNATIONAL_LIST_CAT; } } else { $international_list_cat = <<<INTERNATIONAL_LIST_CAT <div class="domestic-tours"> <ul> <li><a href="#notice">Notice</a></li> </ul> <div id="notice" > <h2> This Page Is Under Construction </h2> <p> No entries have been made on this page. Please check back soon, or click the link below to add an entry! </p> </div> </div> INTERNATIONAL_LIST_CAT; } return $international_list_cat; }// end of international_list_display(); Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/ Share on other sites More sharing options...
Ch0cu3r Posted October 4, 2013 Share Posted October 4, 2013 Can you post the error messages(s) in full here, and can you explain your problem with more info. Such as what was you doing, what should the script do etc? Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/#findComment-1452559 Share on other sites More sharing options...
cyber_alchemist Posted October 4, 2013 Author Share Posted October 4, 2013 (edited) yes, offcourse this my full code : <?php class tourCMS { var $host; var $username; var $password; var $table; public function display_public( ) { $show = $_GET[ 'show' ] + 5; $q = "SELECT * FROM tourDB ORDER BY tour_id DESC LIMIT $show"; $r = mysql_query( $q ); if ( $r !== false && mysql_num_rows( $r ) > 0 ) { while ( $a = mysql_fetch_assoc( $r ) ) { $tour_id = stripslashes( $a[ 'tour_id' ] ); $tour_type = stripslashes( $a[ 'tour_type' ] ); $tour_name = stripslashes( $a[ 'tour_name' ] ); $day = stripslashes( $a[ 'day' ] ); $nights = stripslashes( $a[ 'nights' ] ); $tour_price = stripslashes( $a[ 'tour_price' ] ); $overview = stripslashes( $a[ 'overview' ] ); $itinerary = stripslashes( $a[ 'itinerary' ] ); $terms_conditons = stripslashes( $a[ 'terms_conditons' ] ); $inclusions = stripslashes( $a[ 'inclusions' ] ); $exclusions = stripslashes( $a[ 'exclusions' ] ); $twin_triple_sharing = stripslashes( $a[ 'twin_triple_sharing' ] ); $single_occcupancy = stripslashes( $a[ 'single_occcupancy' ] ); $child_with_no_bed = stripslashes( $a[ 'child_with_no_bed' ] ); $inf_below = stripslashes( $a[ 'inf_below' ] ); $pricing_details = stripslashes( $a[ 'pricing_details' ] ); $url = stripslashes( $a[ 'url' ] ); $entry_display .= <<<ENTRY_DISPLAY <div class="domestic-tours"> <ul> <li><a href="#overview_$url">Overview</a></li> <li><a href="#itinerary_$url">Itinerary</a></li> <li><a href="#inclusions_$url">Inclusions</a></li> <li><a href="#terms_$url">Terms And Conditions</a></li> <li><a href="#price_$url">Tour Price</a></li> </ul> <div id="overview_$url"> <!-- <div id="dest-thumb-nail" class="dest-thumb-nail"> <ul class="bjqs"> <li><img src="img/bangkok/1.jpg" /></li> <li><img src="img/bangkok/2.jpg" /></li> <li><img src="img/bangkok/3.jpg" /></li> <li><img src="img/bangkok/4.jpg" /></li> <li><img src="img/bangkok/5.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> </ul> </div> --> <div class="overview"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights , $day Days</span><br /><br /> $overview </div> </div> <div id="itinerary_$url"> <div class="itin-content"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights, $day Days</span><br /><br /><br /> $itinerary </div> </div> <div id="inclusions_$url"> <div class="inclusions-exclusions"> <span class="inclusions">Inclusions</span><br /><br /> $inclusions <br /> <br /> <span class="exclusions">Exclusions</span><br /><br /> $exclusions <br /> <br /> </div> </div> <div id="terms_$url"> <div class="terms" > <span class="terms-and-conditions" >Terms And Conditions </span><br /><br /> $terms_conditons </div> </div> <div id="price_$url"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> $twin_triple_sharing </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> $single_occcupancy </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> $child_with_no_bed </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price=tab-element" > FREE </div> </div> <button id="book-now">Book Now !</button> <button id="call" >call your travel expert</button> </div> </div> </div> <div class="price-tag-domestic"><span class="pricy-price" >` $tour_price</span></div> <div class="cleaner"></div> ENTRY_DISPLAY; } //$a = mysql_fetch_assoc( $r ) } //$r !== false && mysql_num_rows( $r ) > 0 else { $entry_display = <<<ENTRY_DISPLAY <div class="domestic-tours"> <ul> <li><a href="#notice">Notice</a></li> </ul> <div id="notice" > <h2> This Page Is Under Construction </h2> <p> No entries have been made on this page. Please check back soon, or click the link below to add an entry! </p> </div> </div> ENTRY_DISPLAY; } $entry_display .= <<<ADMIN_OPTION </div> <div class="pager-items" > <div class="pager-display-element"> <ul id="icons" class="ui-widget ui-helper-clearfix"> <li class="ui-state-default ui-corner-all">View more Excite Trips</li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=0">5</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=5">10</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=15">20</a></li> <li class="ui-state-default ui-corner-all"><a href="{$_SERVER['PHP_SELF']}?show=45">50</a></li> </ul> </div> </div> <!-- <p class="admin_link"> <a href="{$_SERVER['PHP_SELF']}?admin=1">Add a New Entry</a> <a href="{$_SERVER['PHP_SELF']}?show=0">Show 5</a> <a href="{$_SERVER['PHP_SELF']}?show=5">Show 10</a> <a href="{$_SERVER['PHP_SELF']}?show=15">Show 20</a> <a href="{$_SERVER['PHP_SELF']}?show=35">Show 40</a> <a href="{$_SERVER['PHP_SELF']}?show=45">Show 50</a> <a href="{$_SERVER['PHP_SELF']}?next_end=2">Next</a> </p> --> ADMIN_OPTION; return $entry_display; } //end of display_public() public function display_admin( ) { return <<<ADMIN_FORM <form action="{$_SERVER['PHP_SELF']}" method="post" > <div id="tour-package" > <ul> <li><a href="#genral">General Information</a></li> <li><a href="#picture">Picture And Meta Info</a></li> <li><a href="#tour-inclusions">Tour Inclusions</a></li> <li><a href="#tour-feature">Itinerary</a></li> <!--<li><a href="#availibility">Availability and Others</a></li>--> <li><a href="#billing">Billing And Prices</a></li> </ul> <div id="genral"> <div class="package-element"> <p><span class="left" >Tour Name: <input type="text" name="tour_name" id="tour_name" /></span></p> </div> <div class="package-element"> <p>Tour Type: <select id="tour_type" name="tour_type" > <option value="null-category" checked="checked" >Select Tour Type</option> <option value="international" >International Tours</option> <option value="domestic" > Domestic Tours </option> <option value="insta_deals" >Insta Deals</option> </select> </p> </div> <div class="package-element"> <p>No. of Days: <input type="text" size="2" id="day" name="day" /> </p> </div> <div class="package-element"> <p> No. of Nights: <input type="text" name="nights" id="nights" size="2" /> </p> </div> <div class="package-element" > <p> Sub categories <input type="text" name="categories" id="categories" size="5" /> </p> </div> <div class="package-element"> <div class="package-element-head"> <p>Overview of the package :</p> </div> <br /> <div class="package-element"> <textarea rows="10" cols="70" id="overview" name="overview" ></textarea> </div> </div> <div class="cleaner"></div><br /> </div> <div id="picture" > <div class="chavi" > <div class="package-element-head" > <p>Pictures To upload (.jpg, .png) :</p> </div> <div class="cleaner"></div> <div class="chavi-element" > <span class="left">1st Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic1" id="pic1" /></span> </div> <div class="chavi-element" > <span class="left">2nd Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic2" id="pic2" /></span> </div> <div class="chavi-element"> <span class="left" > 3rd Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic3" id="pic3" /></span> </div> <div class="chavi-element" > <span class="left" >4th Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic4" id="pic4" /></span> </div> <div class="chavi-element" > <span class="left" >5th Image</span><span class="right"><input type="file" accept ="image/gif, image/jpeg" name="pic5" id="pic5" /></span> </div> </div> <div class="meta-info"> <div class="package-element-head" > <p>Title:</p> </div> <div class="package-element" > <input type="text" size="30" id="title" name="title" /> </div> <div class="package-element-head-2" > Keywords: </div> <div class="package-element" > <textarea rows="5" cols="28" id="keywords" name="keywords" ></textarea> </div> </div> <div class="meta-info" > <div class="package-element-head" > Description: </div> <div class="package-element" > <textarea rows="5" cols="30" name="description" id="description"></textarea> </div> <div class="package-element-head-2" > URL of the page: </div> <div class="package-element" > <input type="text" size="30" name="url" id="url" onblur="this.value=removeSpaces(this.value);" /> </div> </div> <div class="cleaner"></div> </div> <div id="tour-inclusions"> <div class="inclusions-exclusions"> <div class="package-element-head" > Inclusions: </div> <div class="package-element" > <textarea rows="10" cols="70" name="inclusions" id="inclusions"></textarea> </div> </div> <div class="inclusions-exclusions"> <div class="package-element-head" > Exlcusions: </div> <div class="package-element"> <textarea rows="10" cols=70" name="exclusions" id="exclusions"></textarea> </div> </div> <div class="cleaner"></div> </div> <div id="tour-feature"> <div class="package-element-head"> Itinerary: </div> <div class="package-element" > <textarea rows="30" cols="75" name="itinerary" id="itinerary"></textarea> </div> <div class="cleaner"></div> </div> <!--<div id="availability">availibility</div>--> <div id="billing"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> <input typ="text" size="7" name="twin_triple_sharing" id="twin_triple_sharing" /> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> <input type="text" size="7" name="single_occcupancy" id="single_occcupancy" /> </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> <input type="text" size="7" name="child_with_no_bed" id="child_with_no_bed" /> </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price-tab-element" > <span class="rupee" >`</span> <input type="text" size="7" name="inf_below" id="inf_below" /> </div> </div> <div class="package-element-head-2">Pricing Details:</div> <div class="cleaner"></div> <div class="package-element" > <textarea rows="10" cols="70" id="pricing_details" name="pricing_details" ></textarea> </div> <input type="submit" id="submit" value="Create This Entry!" /> <div class="cleaner" ></div> </div> </div> </div> </form> <!-- <form action="{$_SERVER['PHP_SELF']}" method="post"> <label for="title">Title:</label><br /> <input name="title" id="title" type="text" maxlength="150" /> <div class="clear"></div> <label for="bodytext">Body Text:</label><br /> <textarea name="bodytext" id="bodytext"></textarea> <div class="clear"></div> --> </form> <br /> </div> ADMIN_FORM; } public function write( $p ) { /* $dir ='./images/'; $thumbdir = $dir . '/thumbs'; if (isset($_FILES['pic1']) && isset($_FILES['pic2']) && isset($_FILES['pic3']) && isset($_FILES'pic4']) && isset($_FILES['pic5']) ) { //make sure the uploaded file transfer was successful if ($_FILES['pic1']['error'] != UPLOAD_ERR_OK && $_FILES['pic2']['error'] != UPLOAD_ERR_OK && $_FILES['pic3']['error'] != UPLOAD_ERR_OK && $_FILES['pic4']['error'] != UPLOAD_ERR_OK && $_FILES['pic5']['error'] != UPLOAD_ERR_OK) { switch ($_FILES['pic1']['error'] &&) { case UPLOAD_ERR_INI_SIZE: die('The uploaded file exceeds the upload_max_filesize directive ' . 'in php.ini.'); break; case UPLOAD_ERR_FORM_SIZE: die('The uploaded file exceeds the MAX_FILE_SIZE directive that ' . 'was specified in the HTML form.'); break; case UPLOAD_ERR_PARTIAL: die('The uploaded file was only partially uploaded.'); break; case UPLOAD_ERR_NO_FILE: die('No file was uploaded.'); break; case UPLOAD_ERR_NO_TMP_DIR: die('The server is missing a temporary folder.'); break; case UPLOAD_ERR_CANT_WRITE: die('The server failed to write the uploaded file to disk.'); break; case UPLOAD_ERR_EXTENSION: die('File upload stopped by extension.'); break; } } */ if ( $_POST[ 'tour_name' ] ) $tour_name = mysql_real_escape_string( $_POST[ 'tour_name' ] ); if ( $_POST[ 'tour_type' ] ) $tour_type = mysql_real_escape_string( $_POST[ 'tour_type' ] ); if ( $_POST[ 'day' ] ) $day = mysql_real_escape_string( $_POST[ 'day' ] ); if ( $_POST[ 'nights' ] ) $nights = mysql_real_escape_string( $_POST[ 'nights' ] ); if ( $_POST[ 'twin_triple_sharing' ] ) $twin_triple_sharing = mysql_real_escape_string( $_POST[ 'twin_triple_sharing' ] ); if ( $_POST[ 'overview' ] ) $overview = mysql_real_escape_string( $_POST[ 'overview' ] ); if ( $_POST[ 'itinerary' ] ) $itinerary = mysql_real_escape_string( $_POST[ 'itinerary' ] ); if ( $_POST[ 'inclusions' ] ) $inclusions = mysql_real_escape_string( $_POST[ 'inclusions' ] ); if ( $_POST[ 'exclusions' ] ) $exclusions = mysql_real_escape_string( $_POST[ 'exclusions' ] ); if ( $_POST[ 'single_occcupancy' ] ) $single_occcupancy = mysql_real_escape_string( $_POST[ 'single_occcupancy' ] ); if ( $_POST[ 'child_with_no_bed' ] ) $child_with_no_bed = mysql_real_escape_string( $_POST[ 'child_with_no_bed' ] ); if ( $_POST[ 'inf_below' ] ) $inf_below = mysql_real_escape_string( $_POST[ 'inf_below' ] ); if ( $_POST[ 'keywords' ] ) $keywords = mysql_real_escape_string( $_POST[ 'keywords' ] ); if ( $_POST[ 'title' ] ) $title = mysql_real_escape_string( $_POST[ 'title' ] ); if ( $_POST[ 'description' ] ) $description = mysql_real_escape_string( $_POST[ 'description' ] ); if ( $_POST[ 'url' ] ) $url = mysql_real_escape_string( $_POST[ 'url' ] ); if ( $_POST['categories'] ) $categories = mysql_real_escape_string( $_POST['categories'] ); if ( isset( $tour_name ) && isset( $day ) && isset( $nights ) && isset( $twin_triple_sharing ) && isset( $overview ) && isset( $itinerary ) && isset( $inclusions ) && isset( $exclusions ) && isset( $single_occcupancy ) && isset( $child_with_no_bed ) && isset( $inf_below ) && isset( $keywords ) && isset( $title ) && isset( $description ) && isset( $categories ) ) { $sql = "INSERT INTO tourDB (tour_name, tour_type, day, nights, overview, itinerary, inclusions, exclusions, twin_triple_sharing, single_occcupancy, child_with_no_bed, inf_below, keywords, title, description, url, categories) VALUES ('$tour_name', '$tour_type', '$day', '$nights', '$overview', '$itinerary', '$inclusions', '$exclusions', '$twin_triple_sharing', '$single_occcupancy', '$child_with_no_bed', '$inf_below', '$keywords', '$title' , '$description', '$url', '$categories' )"; return mysql_query( $sql ) or die( mysql_error() ); } //isset( $tour_name ) && isset( $day ) && isset( $nights ) && isset( $twin_triple_sharing ) && isset( $overview ) && isset( $itinerary ) && isset( $inclusions ) && isset( $exclusions ) && isset( $single_occcupancy ) && isset( $child_with_no_bed ) && isset( $inf_below ) && isset( $keywords ) && isset( $title ) && isset( $description ) else { return false; } } //end of write($p) public function connect( ) { mysql_connect( $this->host, $this->username, $this->password ) or die( "Could not connect. " . mysql_error() ); mysql_select_db( $this->table ) or die( "Could not select database. " . mysql_error() ); return $this->buildDB(); } //end of connect() private function buildDB( ) { $sql = <<<MySQL_QUERY CREATE TABLE IF NOT EXISTS tourDB ( tour_id INTEGER NOT NULL AUTO_INCREMENT, tour_type VARCHAR(20) NOT NULL, tour_name VARCHAR(255) NOT NULL, day INTEGER NOT NULL, nights INTEGER NOT NULL, tour_price VARCHAR(25) NOT NULL, overview TEXT NOT NULL, itinerary TEXT NOT NULL, terms_conditons TEXT NOT NULL, inclusions TEXT NOT NULL, exclusions TEXT NOT NULL, twin_triple_sharing INTEGER NOT NULL, single_occcupancy INTEGER NOT NULL, child_with_no_bed INTEGER NOT NULL, inf_below INTEGER NOT NULL, pricing_details TEXT, keywords VARCHAR(155) NOT NULL, title VARCHAR(25) NOT NULL, description VARCHAR(136) NOT NULL, url VARCHAR(500) NOT NULL, categories VARCHAR(40) NOT NULL, PRIMARY KEY (tour_id) ) ENGINE="MyISLAM" MySQL_QUERY; return mysql_query( $sql ) or die( mysql_error() ); } //buildDB() public function display_international( ) { $query = 'SELECT * FROM tourDB WHERE tour_type = "international"'; $result = mysql_query( $query ) or die( mysql_error() ); if ( $result !== false && mysql_num_rows( $result ) > 0 ) { while ( $i = mysql_fetch_assoc( $result ) ) { $international_cats = stripslashes( $i[ 'categories' ] ); $international_display .= <<<PANEL_DISPLAY <a class="international-tour-box-element" href=# >$international_cats</a> PANEL_DISPLAY; } //$b = mysql_fetch_assoc( $result ) } //$result !== false && mysql_num_rows( $result ) > 0 else { $international_display = <<<PANEL_DISPLAY <a class="international-tour-box-element" href="#" >No tours !</a> PANEL_DISPLAY; } return $international_display; } // end of display_international() public function display_domestic( ) { $query = 'SELECT * FROM tourDB WHERE tour_type = "domestic"'; $result = mysql_query( $query ) or die( mysql_error() ); if ( $result !== false && mysql_num_rows( $result ) > 0 ) { while ( $d = mysql_fetch_assoc( $result ) ) { $domestic_cats = stripslashes( $d[ 'categories' ] ); $domestic_display .= <<<PANEL_DISPLAY <a class="domestic-tour-box-element" href="#">$domestic_cats</a> PANEL_DISPLAY; } //$d = mysql_fetch_assoc( $result ) } //$result !== false && mysql_num_rows( $result ) > 0 else { $domestic_display = <<<PANEL_DISPLAY <a class="domestic-tour-box-element" href="#">No tours</a> PANEL_DISPLAY; } return $domestic_display; } // end of display_domestic () public function display_insta( ) { $query = 'SELECT * FROM tourDB WHERE tour_type = "insta_deals"'; $result = mysql_query( $query ) or die( mysql_error() ); if ( $result !== false && mysql_num_rows( $result ) > 0 ) { while ( $s = mysql_fetch_assoc( $result ) ) { $insta_cats = stripslashes( $s[ 'categories' ] ); $insta_display .= <<<PANEL_DISPLAY <a class="insta-deals-box-element" href="#">$insta_cats</a> PANEL_DISPLAY; } //$s = mysql_fetch_assoc( $result ) } //$result !== false && mysql_num_rows( $result ) > 0 else { $insta_display = <<<PANEL_DISPLAY <a class="insta-deals-box-element" href="#">No Tour!</a> PANEL_DISPLAY; } return $insta_display; } //end of display_insta(); public function international_list_display() { $international_categories = $_GET['international_categories']; $query = 'SELECT * FROM tourDB WHERE categories = "$international_categories"'; $result = mysql_query( $query ) or die ( mysql_error() ); if ( $result !== false && mysql_num_rows($result) > 0 ) { while ( $ilist = mysql_num_rows( $result ) > 0) { $tour_id = stripslashes( $ilist[ 'tour_id' ] ); $tour_type = stripslashes( $ilist[ 'tour_type' ] ); $tour_name = stripslashes( $ilist[ 'tour_name' ] ); $day = stripslashes( $ilist[ 'day' ] ); $nights = stripslashes( $ilist[ 'nights' ] ); $tour_price = stripslashes( $ilist[ 'tour_price' ] ); $overview = stripslashes( $ilist[ 'overview' ] ); $itinerary = stripslashes( $ilist[ 'itinerary' ] ); $terms_conditons = stripslashes( $ilist[ 'terms_conditons' ] ); $inclusions = stripslashes( $ilist[ 'inclusions' ] ); $exclusions = stripslashes( $ilist[ 'exclusions' ] ); $twin_triple_sharing = stripslashes( $ilist[ 'twin_triple_sharing' ] ); $single_occcupancy = stripslashes( $ilist[ 'single_occcupancy' ] ); $child_with_no_bed = stripslashes( $ilist[ 'child_with_no_bed' ] ); $inf_below = stripslashes( $ilist[ 'inf_below' ] ); $pricing_details = stripslashes( $ilist[ 'pricing_details' ] ); $url = stripslashes( $ilist[ 'url' ] ); $international_list_cat .= <<<INTERNATIONAL_LIST_CAT <div class="domestic-tours"> <ul> <li><a href="#overview_$url">Overview</a></li> <li><a href="#itinerary_$url">Itinerary</a></li> <li><a href="#inclusions_$url">Inclusions</a></li> <li><a href="#terms_$url">Terms And Conditions</a></li> <li><a href="#price_$url">Tour Price</a></li> </ul> <div id="overview_$url"> <!-- <div id="dest-thumb-nail" class="dest-thumb-nail"> <ul class="bjqs"> <li><img src="img/bangkok/1.jpg" /></li> <li><img src="img/bangkok/2.jpg" /></li> <li><img src="img/bangkok/3.jpg" /></li> <li><img src="img/bangkok/4.jpg" /></li> <li><img src="img/bangkok/5.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> <li><img src="img/bangkok/6.jpg" /></li> </ul> </div> --> <div class="overview"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights , $day Days</span><br /><br /> $overview </div> </div> <div id="itinerary_$url"> <div class="itin-content"> <span class="overview-heading">$tour_name</span><br /><br /> <span class="overview-duration">$nights Nights, $day Days</span><br /><br /><br /> $itinerary </div> </div> <div id="inclusions_$url"> <div class="inclusions-exclusions"> <span class="inclusions">Inclusions</span><br /><br /> $inclusions <br /> <br /> <span class="exclusions">Exclusions</span><br /><br /> $exclusions <br /> <br /> </div> </div> <div id="terms_$url"> <div class="terms" > <span class="terms-and-conditions" >Terms And Conditions </span><br /><br /> $terms_conditons </div> </div> <div id="price_$url"> <div class="price-tab" > <div class="price-tab-row" > <div class="price-tab-element"> <b>Pax Type</b> </div> <div class="price-tab-element"> <b>Tour Price Total in INR</b> </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Twin/Triple Sharing </div> <div class="price-tab-element" > <span class="rupee">`</span> $twin_triple_sharing </div> </div> <div class="price-tab-row" > <div class="price-tab-element" > Single Occupancy </div> <div class="price-tab-element" > <span class="rupee">`</span> $single_occcupancy </div> </div> <div class="price-tab-row"> <div class="price-tab-element" > Child With No Bed </div> <div class="price-tab-element"> <span class="rupee" >`</span> $child_with_no_bed </div> </div> <div class="price-tab-row"> <div class="price-tab-element"> Infant below 2 years </div> <div class="price=tab-element" > FREE </div> </div> <button id="book-now">Book Now !</button> <button id="call" >call your travel expert</button> </div> </div> </div> <div class="price-tag-domestic"><span class="pricy-price" >` $tour_price</span></div> <div class="cleaner"></div> INTERNATIONAL_LIST_CAT; } } else { $international_list_cat = <<<INTERNATIONAL_LIST_CAT <div class="domestic-tours"> <ul> <li><a href="#notice">Notice</a></li> </ul> <div id="notice" > <h2> This Page Is Under Construction </h2> <p> No entries have been made on this page. Please check back soon, or click the link below to add an entry! </p> </div> </div> INTERNATIONAL_LIST_CAT; } return $international_list_cat; }// end of international_list_display(); } ?> I was trying to make a function , which gives a output based on the $_GET['international_categories']; , it receives the MySQL sorts out the rows which has the specified $_GET['international_categories'] values and returns them in a html/css/java format. and this is the error:" Parse error: syntax error, unexpected '?>', expecting function (T_FUNCTION) in tourCMS.php on line 729 " Edited October 4, 2013 by cyber_alchemist Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/#findComment-1452563 Share on other sites More sharing options...
Solution Ch0cu3r Posted October 4, 2013 Solution Share Posted October 4, 2013 (edited) On line 703 remove the spaces after INTERNATIONAL_LIST_CAT; the closing heredoc delimiter cannot have anything directly after it other than a newline. You have about about 32 spaces after it, this is what is causing the erro Edited October 4, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/#findComment-1452567 Share on other sites More sharing options...
cyber_alchemist Posted October 4, 2013 Author Share Posted October 4, 2013 hmmm, i guess i am still causing error's in heredocs ..:/ Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/#findComment-1452572 Share on other sites More sharing options...
Ch0cu3r Posted October 4, 2013 Share Posted October 4, 2013 Heredocs can easily lead to errors like this. You need to be extra careful with them. A better approach to heredoc would be to dump your html into seperate files and then just include them as templates. Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/#findComment-1452582 Share on other sites More sharing options...
cyber_alchemist Posted October 5, 2013 Author Share Posted October 5, 2013 uhmm... could i get a simple example of it ?? i googled for a example with no luck . Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/#findComment-1452666 Share on other sites More sharing options...
Ch0cu3r Posted October 5, 2013 Share Posted October 5, 2013 To understand this better. you'll want to look at the MVC design pattern. Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/#findComment-1452678 Share on other sites More sharing options...
cyber_alchemist Posted October 5, 2013 Author Share Posted October 5, 2013 Thanks it helped a lot ! Quote Link to comment https://forums.phpfreaks.com/topic/282709-why-i-am-getting-a-parse-error-of-after-i-wrote-this-in-my-main-code/#findComment-1452699 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.