I tried also some things into the code under but I did not get a good result.
It is for a request-sending but if someone request for a second-time I would like to detect it with the function "where not".
Code: Select all
$stmt = $DB_con->prepare('INSERT INTO topic_requests(over_all_id,title,id_requester,name_requester,e_mail_requester,ip_adres) VALUES(:over_all_id, :title, :id_requester, :name_requester, :e_mail_requester, :ip_adres)');
Code: Select all
<?php
error_reporting( ~E_NOTICE ); // avoid notice
require_once 'dbconfignotice.php';
if(isset($_POST['submit']))
{
$over_all_id = $_POST['over_all_id'];// user email
$title = $_POST['title'];// user email
$id_requester = $_POST['id_requester'];// user email
$name_requester = $_POST['name_requester'];// user email
$e_mail_requester = $_POST['e_mail_requester'];// user email
$ip_adres = $_POST['ip_adres'];// user email
// if no error occured, continue ....
if(!isset($errMSG))
{
$stmt = $DB_con->prepare('INSERT INTO topic_requests(over_all_id,title,id_requester,name_requester,e_mail_requester,ip_adres) VALUES(:over_all_id, :title, :id_requester, :name_requester, :e_mail_requester, :ip_adres)');
$stmt->bindParam(':over_all_id',$over_all_id);
$stmt->bindParam(':title',$title);
$stmt->bindParam(':id_requester',$id_requester);
$stmt->bindParam(':name_requester',$name_requester);
$stmt->bindParam(':e_mail_requester',$e_mail_requester);
$stmt->bindParam(':ip_adres',$ip_adres);
if($stmt->execute())
{
$successMSG = "<script type= 'text/javascript'>alert('New Album Inserted Successfully');</script>";
header("<script type= 'text/javascript'>alert('New Album Inserted Successfully');</script>"); // redirects image view page after 5 seconds.
}
else
{
$errMSG = "error while inserting....";
}
}
}
?>