I have the following PHP file.
<?php header('Content-Type: text/xml'); echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; session_start(); echo '<response>'; $email = $_GET['person']; $UserEmail = $_SESSION['login']; $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); mysql_select_db(DB_DATABSE, $conn); $sql_find = mysql_query("SELECT * FROM Users WHERE UserEmail='".$email."' LIMIT 1"); if(mysql_fetch_array($sql_find)) { $sql_add = "UPDATE Users SET Contacts = concat(Contacts, ';', '".$email."') WHERE UserEmail = '".$UserEmail."'"; if (mysql_query($conn, $sql_add)) { echo array( 'found' => true, 'msg' => "Person added to your record"); } else { echo array( 'found' => false, 'msg' => "Error adding person to your record \n Is the person emails' correct?"); } } else { echo array( 'found' => false, 'msg' => "We couldn't find the user in our databases."); } echo '</response>'; ?> I use Ajax to add data to MySql and return the result to front-end. The problem is that even if the SQL code work when I tested to my server PhPAdmin, it shows me the following error:
XML Parsing Error: mismatched tag. Expected: </br>. Location: http://secretsea.comli.com/lib/addPerson.php Line Number 3, Column 261:<br><table border='1' cellpadding='2' bgcolor='#FFFFDF' bordercolor='#E8B900' align='center'><tr><td><div align='center'><a href='http://www.000webhost.com/'><font face='Arial' size='1' color='#000000'>Free Web Hosting</font></a></div></td></tr></table>Array</response> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ I tried to find a solution on the website and other resourses, but I couldn't understand what am I doing wrong. Is my syntax wrong?
No comments:
Post a Comment