<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at.>
This error message keeps popping out (syntax error, unexpected ‘else’ (T_ELSE)) the else that has error is the one i bolded, can anyone help? I’ve tried including if else statement but it doesnt help
<?php
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("travelstoredb") or die(mysql_error());
$file = $_FILES['image']['tmp_name'];
if (!isset($file))
echo"Please select an image";
else
{
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name = addslashes( $_FILES['image']['name']);
$image_size = getimagesize($_FILES['image']['tmp_name']) ;
}
if ($image_size==FALSE)
echo "That's not an image";
else
{
if (!$insert = mysql_query("INSERT INTO storeimage VALUES ('','$image_name','$image')"));
echo "There is a problem with uploading the image.";
**else**
{
$lastid = mysql_insert_id();
echo "Image uploaded.<p /> Your image:<p /><img src=get.php?id=$lastid>";
}
}
}
?>
if (!$insert = mysql_query("INSERT INTO storeimage VALUES ('','$image_name','$image')") {
echo "There is a problem with uploading the image.";
} else {
$lastid = mysql_insert_id();
echo "Image uploaded.<p /> Your image:<p /><img src=get.php?id=$lastid>";
}