ksmatthews Posted January 10, 2007 Share Posted January 10, 2007 HI THere,I am using the code below to generate XML dynamically from Access DB SQL queries.The raw XML is formatted using an XSL stylesheet as detailed in line 2Up to this point the code has worked fine but recently I changed hosts and the code now generates an error as follows: "Parse error on line 1"I have tried to resolve this by putting the first two line within PHP as follows:echo("<?xml version="1.0" encoding="UTF-8"?>");echo("<?xml-stylesheet href="view_halls.xsl" type="text/xsl"?>");This too does not work ! I think the problem is with the double quotes inside these two lines.The new IIS server is using PHP 4.3.11BEGIN SOURCE:<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="view_halls.xsl" type="text/xsl"?><SERVICES><?php /* script to list all the products in the prodList table use default ODBC connection variables $dbConn - database connection $sqlQuery - a query string $dbResult - result of a, SQL query $rows - number of rows 1. From the home page, student clicks link to View Housing Halls2. Retrieve all [Hallname], [Addressid], [ResidenceDirector] from table [Hall]3. Using [Hall.Addressid], query table [Address] to retrieve [StreetName] for each Hall4. Using [Hall.ResidenceDirector], query table [Person] to retrieve [GivenName], [FamilyName], [EmailID] for each hall director5. Information sent from DB server to web client as a dynamic web page.6. If not OK, error message is sent to student and system exits */ // row counter $counter = 1; // connect to the database $dbConn = odbc_connect("G1RDBMS","","") or die("<ERROR>Error opening database .... use the BACK button</ERROR></SERVICES>"); // Retrieve all [Hallname], [Addressid], [ResidenceDirector] from table [Hall] $sqlQuery = "select * FROM Hall"; $dbResult = odbc_exec($dbConn,$sqlQuery) or die("<ERROR>Error, Hall Listing failed .... use the BACK button</ERROR></SERVICES>"); $res = odbc_fetch_row($dbResult); if ($res == FALSE) { die("<ERROR>Error, there are no rows in the Hall table. Press Back button</ERROR></SERVICES>"); } else { while ($res == TRUE) { // capture data $ac_name = odbc_result ($dbResult, "Hallname"); $ac_Addressid = odbc_result ($dbResult, "Addressid"); $ac_ResidenceDirector = odbc_result ($dbResult, "ResidenceDirector"); // Using [Hall.Addressid], query table [Address] to retrieve [StreetName] for each Hall LOOP $sqlQuery = ""; $sqlQuery = "select StreetName FROM Address where Addressid=" . (integer)$ac_Addressid; $dbResult2 = odbc_exec($dbConn,$sqlQuery) or die("<ERROR>Error, Address Listing failed .... use the BACK button</ERROR></SERVICES>"); $res2 = odbc_fetch_row($dbResult2); if ($res2 == FALSE) { die("<ERROR>Error, Addressid '" . $ac_Addressid . "' does not exist in the Address table. Press the back button to continue</ERROR></SERVICES>"); } else { // capture data $ac_streetName = odbc_result ($dbResult2, "StreetName"); } // Using [Hall.ResidenceDirector (= Person.Personid)], query table [Person] to retrieve [GivenName], [FamilyName], [EmailID] // for each hall director $sqlQuery = ""; $sqlQuery = "select GivenName,FamilyName,EmailID FROM Person where Personid=" . (integer)$ac_ResidenceDirector; $dbResult3 = odbc_exec($dbConn,$sqlQuery) or die("<ERROR>Error, Person Listing failed .... use the BACK button</ERROR></SERVICES>"); $res3 = odbc_fetch_row($dbResult3); if ($res3 == FALSE) { die("<ERROR>Error, the ResidenceDirector '" . $ac_ResidenceDirector . "' does not exist in the Person table. Press the back button to continue</ERROR></SERVICES>"); } else { // capture data $ac_name1 = odbc_result ($dbResult3, "GivenName"); $ac_name2 = odbc_result ($dbResult3, "FamilyName"); $ac_email = odbc_result ($dbResult3, "EmailID"); } // populate XML echo("<ITEM>"); echo("<ITEMCOUNT>" . $counter . "</ITEMCOUNT>"); echo("<HS_NAME>" . $ac_name . "</HS_NAME>"); echo("<HS_ADD>" . $ac_streetName . "</HS_ADD>"); echo("<HS_DIRECTOR>" . $ac_name2 . ", " . $ac_name1 . "</HS_DIRECTOR>"); echo("<HS_EMAIL>" . $ac_email . "</HS_EMAIL>"); echo("</ITEM>"); $res = odbc_fetch_row($dbResult); $counter++; } } odbc_close($dbConn);?></SERVICES>END OF SOURCEAny advice would be appreciated,regards,Steven Matthews Quote Link to comment https://forums.phpfreaks.com/topic/33597-impossible-parse-error/ Share on other sites More sharing options...
HuggieBear Posted January 10, 2007 Share Posted January 10, 2007 Yes, they would cause a parse error...echo '<?xml version="1.0" encoding="UTF-8"?>';echo '<?xml-stylesheet href="view_halls.xsl" type="text/xsl"?>';The above should work... Also, please put [nobbc][code]...[/code][/nobbc] tags around your code[code]<?php // This is a lot nicer to read?>[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/33597-impossible-parse-error/#findComment-157401 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.