I'm trying to learn php. I decided to do a simple system as practice. I am able to add data to my database. Now, I wanted to prevent the user from adding data if the id of the project already exists in the database. I am also able to do that. My problem is the text always shows that the transaction is'Successful' though it's not. Any response will be appreciated. Any response will be appreciated. Here is my code:
$query = "select * from setup_project where spin='$sspin' order by title";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
if ($numrows == 0)
$query = mysql_query("insert into setup_project value ('$sspin','$stitle','$sfirm_id','$sequip','$sdateapp','$samnt','$srem');");
else{
echo "SPIN already Exists!";
}
$message = "Successfully Added Project to Database!";
?>
<br><br><br><br><br><br>
<center><font size="6"><? echo "$message" ?></font></center>