Forum Moderators: coopster

Message Too Old, No Replies

Why does this cause a parse error?

         

mhop

9:27 am on Oct 23, 2004 (gmt 0)

10+ Year Member



This is the next line after a block of php code. It causes a parse error.

<?xml version="1.0" encoding="iso-8859-1"?>

If I comment this line out, no parse error.


The entire block follows:

<?php require_once('Connections/connTrio.php');?>
<?php
$maxRows_rs_Comment = 10;
$pageNum_rs_Comment = 0;
if (isset($_GET['pageNum_rs_Comment'])) {
$pageNum_rs_Comment = $_GET['pageNum_rs_Comment'];
}
$startRow_rs_Comment = $pageNum_rs_Comment * $maxRows_rs_Comment;

mysql_select_db($database_connTrio, $connTrio);
$query_rs_Comment = "SELECT * FROM comments ORDER BY LAST_NAME ASC";
$query_limit_rs_Comment = sprintf("%s LIMIT %d, %d", $query_rs_Comment, $startRow_rs_Comment, $maxRows_rs_Comment);
$rs_Comment = mysql_query($query_limit_rs_Comment, $connTrio) or die(mysql_error());
$row_rs_Comment = mysql_fetch_assoc($rs_Comment);

if (isset($_GET['totalRows_rs_Comment'])) {
$totalRows_rs_Comment = $_GET['totalRows_rs_Comment'];
} else {
$all_rs_Comment = mysql_query($query_rs_Comment);
$totalRows_rs_Comment = mysql_num_rows($all_rs_Comment);
}
$totalPages_rs_Comment = ceil($totalRows_rs_Comment/$maxRows_rs_Comment)-1;
?>
<?xml version="1.0" encoding="iso-8859-1"?>

Code Sentinel

1:42 pm on Oct 23, 2004 (gmt 0)

10+ Year Member



does your server support short tags?

php might be trying to parse the stuff between <? and?>

encyclo

1:48 pm on Oct 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com], mhop.

Code Sentinel has the right answer: you will have to echo the XML prolog to make it work.

<?php echo '<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n';?>

mhop

3:28 pm on Oct 23, 2004 (gmt 0)

10+ Year Member



That was the problem, I had short tags ON.

I turned that option off, and it works now.

Also, thanks for the tip on echoing to solve the problem