0

I Get the error: error on line 1 at column 390: Opening and ending tag mismatch: genre line 0 and songs.

<?php
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='ISO-8859-1'?>";
echo "<songs>";
$sr = $_GET["sr"];
$conn = new PDO("mysql:host=localhost;dbname=xxxxx;","xxxxx","xxxxx");
$songresults = $conn->query("SELECT * FROM `smashhits` WHERE artist LIKE'%$sr%'");
while($row=$songresults->fetch())
{
echo "<id> ID: $row[ID] </id>";
echo "<song> Song: $row[song] </song>";
echo "<artist> Artist: $row[artist] </artist>";
echo "<year> Year: $row[year] </year>";
echo "<genre> Genre: $row[genre] <genre>";
echo "<quantity> Quantity: $row[quantity] </quantity>";
}
echo "</songs>"
?>

I would be thankful for anyone who knows what's going wrong with the code above.

1
  • 1
    Typo in your code. Your second <genre> should be </genre> Commented Sep 30, 2014 at 19:58

1 Answer 1

2

Simple error:

echo "<genre> Genre: $row[genre] <genre>";

You've opened two genre tags. I'm sure you don't need me to tell you that it should be

echo "<genre> Genre: $row[genre] </genre>";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.