Editing PHP Pages

Hi All,

Im trying to add page titles to a webpage thats in PHP. I am opening the pages in note pad and changing them accordingly. However once the edited pages are uploaded the live page shows an invalid syntax error.

This is really odd because I am not changing the tags of the section in which the text is located. All I am doing is replacing the text with different text.

The text I have highlighted in red is the only area of the page I have changed with notepad. Hence my confusion?

Any ideas?
 
Is this not just you putting the html within the php?

Code:
<meta name="keywords" content="Westcountry Fire Protection, Westcountry Fire Protection, West Country Fire Protection, Fire Prevention, Fire Protection, WFP, "><meta name="description" content="Westcountry Fire Protection's home page - we offer comprehensive products and services with friendly, professional and local advice.">
 
PHP:
<?php
$this_page = "index";
?>

<meta name="keywords" content="Westcountry Fire Protection, Westcountry Fire Protection, West Country Fire Protection, Fire Prevention, Fire Protection, WFP, ">

	<meta name="description" content="Westcountry Fire Protection's home page - we offer comprehensive products and services with friendly, professional and local advice.">

<?php
$browser_title = "Westcountry Fire Protection > Sentri > Fire Alarms Exeter > Fire Alarms Newton Abbot ";
?>
<meta name="keywords" content="Westcountry Fire Protection, Westcountry Fire Protection, West Country Fire Protection, Fire Prevention, Fire Protection, WFP, ">
<meta name="description" content="Westcountry Fire Protection's home page - we offer comprehensive products and services with friendly, professional and local advice.">

<?php
include("includes/header.php");
include("includes/database.php");

// Get latest News Stories

$news_sql = "SELECT id, headline, extract, body, created, author, category, status, starts, expires, CASE WHEN starts != 0 THEN 'yes' ELSE 'no' END AS 'starts_flag', CASE WHEN expires != 0 THEN 'yes' ELSE 'no' END AS 'expires_flag' from syscon_news WHERE status = 'live' ORDER BY created DESC limit 0,4"; 
$news_query = mysql_query($news_sql, $db_handle);

$length = 120;

while($news_record = mysql_fetch_array($news_query)) { 
	
	unset($status);
	
	if($news_record['starts_flag'] == "no" && $news_record['expires_flag'] == "no") { 
		$status = "yes";			
	} elseif($news_record['starts_flag'] == "yes" && date(U) > $news_record['starts']) { 
		$status = "yes";
	} elseif($news_record['expires_flag'] == "yes" && date(U) < $news_record['expires']) { 
		$status = "yes";
	}
	
	if($status == "yes") { 
		
		if(strlen($news_record['extract']) > $length) { 
			$extract = stripslashes(substr($news_record['extract'],0,$length)) . "...";
		} else { 
			$extract = stripslashes($news_record['extract']);
		}
		
		$latest_news[] = array(
			id => $news_record['id'],
			headline => stripslashes($news_record['headline']),
			extract => $extract,
			body => stripslashes($news_record['body']),
			created => $news_record['created'],
			author => stripslashes($news_record['author']),
			category => $news_record['category'],
			status => $news_record['status'],
			expires => $news_record['expires']
		);	
	}				
}
?>
 
PHP:
$browser_title = "Westcountry Fire Protection > Sentri > Fire Alarms Exeter > Fire Alarms Newton Abbot";
 
The difference is the appearance of special characters (>). Try making them entities ( > )
 
Are you sure that fixed your problem as that doesn't make sense if it did. :confused:
First off granted all the ">" are bad HTML but they are in quote marks so will be treated as part of a string and not special characters in the PHP langauge so that shouldn't flag up any issues.

Secondly your error is for the "<" less than not the ">" greater than symbol and all the symbols that you changed to entities are greater than symbols not less than symbols so again I can't see how that fixed it.

A tad confused if that was the solution TBH. :)
 
Jazajay said:
Are you sure that fixed your problem as that doesn't make sense if it did. :confused:
First off granted all the ">" are bad HTML but they are in quote marks so will be treated as part of a string and not special characters in the PHP langauge so that shouldn't flag up any issues.

Secondly your error is for the "<" less than not the ">" greater than symbol and all the symbols that you changed to entities are greater than symbols not less than symbols so again I can't see how that fixed it.

A tad confused if that was the solution TBH. :)

I had exactly the same thoughts Jaz, but that was the only anomaly I could spot in the whole script :S
 
Back
Top