Jump to content

super annoying trailing "1"


dzhax

Recommended Posts

I am using a database to handle all my navigation and page content. after running into issues with holding php code in a sql database and then displaying it properly when called i decided to just store the location of the php file for it to call.Everything works fine if the code is all html and therefore able to be stored withing the database, its when i am using to only call a php file a rouge 1 keeps getting added to bottom of only those pages.Database Pages:

id		  title		  body					file1		   Home		   <div>......</div>	   NULL2		   News		   NULL					news.php3		   About		  <div>......</div>	   NULL4		   Profile		NULL					profiles.php...

Obviously this is just a sample of what the database looks like.The Code:

if($_GET['p'] != NULL) {	 $query=("select * from pages WHERE title = '" . $_GET['p'] . "'");	 $result=mysql_query($query) or die ("SVFD Website is having problems with the database please check back later. Thanks. - Error 3");	 while($content=mysql_fetch_array($result)){		  $body = $content['body'];		  if (isset($content['file'])) $body = include('add-ons/' . $content['file']);		  $Pname = $content['title'];	 }	 echo $body;	 echo '<div class="margin_bottom_20"></div>';} else {...

This is the code that i am using that prints the data requested to the page. The 1 that shows up appears to be appended to the $body because it shows up before the <div class="margin_bottom_20"> if you view the source. The 1 only shows on the pages that grab a php file i.e News and Profile.Source From History Page:

<div class="templatemo_content margin_right_10" id="content" style="width: 680px;">	 <h1 style="text-align: center;">		  <strong>			   Past, Present, and Future		  </strong>	 </h1>	 <table>		  <tbody>			   <tr>					<td>						 <div class="rc_btn_01 fl" style="padding-left: 115px;">							  <a href="java script:ajaxpagefetcher.load('content', 'index.php?p=apparatus', false)">								   Apparatus History							  </a>						 </div>						 <div class="rc_btn_01 fl">							  <a href="java script:ajaxpagefetcher.load('content', 'index.php?p=chief', false)">								   Chief History							  </a>						 </div>						 <div class="rc_btn_01 fl">							  <a href="java script:ajaxpagefetcher.load('content', 'index.php?p=general', false)">								   General History							  </a>						 </div>						 <div class="rc_btn_01 fl">							  <a href="java script:ajaxpagefetcher.load('content', 'index.php?p=historiccalls', false)">								   Historic Calls							  </a>						 </div>					</td>			   </tr>		  </tbody>	 </table>	 <br>	 <div id="history">	 </div>	 1				<<<<<<<<<<<<<<<<<<<<<<  There is the rouge 1	 <div class="margin_bottom_20"></div>	 </div>

Noted in the source on the third to last line is where the rouge 1 is showing up. It is not hard coded or anything.I am stumped at this point not sure if it is a sql thing or a php thing.Any help much appriciated.EDIT: NVM I FOUND THE PROBLEM... OMG problem was i had $body = include.... instead of just include !!!! I just spent all this time making this post and it was that simple.... Sry guys.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...