danwoods Posted October 16, 2009 Share Posted October 16, 2009 Hello all. It's been a while since I've hunkered down and had some fun with php, so I'm a little out of practice. I have what I think is a very simple script: <?php ini_set('display_errors', 'On'); error_reporting(E_ALL | E_STRICT); header('Content-Type: text/xml'); //connect with database $con = mysql_connect("localhost","***","***"); if(!$con){ die('Could not connect: ' . mysql_error()); } mysql_select_db("musicneverstopped", $con); //end connecting to database //declare placeholders $artist = $_GET['artist']; $result = mysql_query("SELECT * FROM artists WHERE name = '$artist'"); //error check - see if this is safe to remove later if(!$result){ die(mysql_error()); } //check if any results were returned if(mysql_num_rows($result) > 0){ while($row = mysql_fetch_array($result)){ $response = $row['abb']; }//end while } echo $response; //close database connection mysql_close($con);//close mysql connection ?> When I call it and pass it a value it gives me an error like: XML Parsing Error: syntax error Location: http://localhost/MSNTesting/newDropDownFiles/php/artistToAbb.php?artist=John+Mayer Line Number 1, Column 1: jm ^ When "jm" is the proper return value. What could be causing this error? Thanks in advance... Link to comment https://forums.phpfreaks.com/topic/177979-simple-script-returning-propper-values-but-throwing-error/ Share on other sites More sharing options...
xtopolis Posted October 17, 2009 Share Posted October 17, 2009 XML Parsing Error: syntax error It means your XML is improperly formatted. Fix the XML/XML output so that it follows the spec and it will no longer throw the error. Link to comment https://forums.phpfreaks.com/topic/177979-simple-script-returning-propper-values-but-throwing-error/#findComment-938451 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.