Hi, I have this code with an SQL query that i've written. I'm tired and can't see where i'm going wrong, i'm getting a "T_ELSE" error on the first else command before the loop starts. I'm pretty sure it's to do with my structure of opening and close correctly. If someone could point out where i've gone wrong and possibly what to look out for I would be very greatful.
<?php
$conn = mysql_connect("localhost", "1234", "1234");
mysql_select_db("12345");
$id = $_POST["id"];
$t = $_POST["song"];
$a = $_POST["artist"];
$y = $_POST["year"];
$q = $_POST["quantity"];
$p = $_POST["price"];
$mysql = "";
if ($t !="" && $a !="" && $y !="" && $q !="" && $p !="")
{
$sql = "UPDATE hits SET column2='$t', column3='$a', column4='$y', column6='$q', column7='$p' WHERE column1='$id'";
$result = mysql_query($sql);
}
else
{
while($row = mysql_fetch_array($result))
{
echo "<p>";
echo " You have succesfully changed the details for Hit ID: $id <br/>";
echo " ID: $row[id] <br/> ";
echo " Song Title $row[song] <br/> ";
echo " Artist $row[artist] <br/> ";
echo " Year $row[year] <br/> ";
echo " Quantity $row[quantity] <br/> ";
echo " Price $row[price] <br/> ";
echo "</p>";
}
}
else
{
echo "Please make sure all fields have been filled before submission.";
}
mysql_close($conn);
?>