troubleshooting Question

check mysql insert

Avatar of James Murrell
James MurrellFlag for United Kingdom of Great Britain and Northern Ireland asked on
PHPMySQL ServerSQL
12 Comments4 Solutions308 ViewsLast Modified:
i have this insert


require('db.php');

$ud_ID = $_SESSION['submissionID'];
$circuitId= mysql_real_escape_string($_POST['circuitId']);
$Race1=mysql_real_escape_string($_POST['Race']);  
$first=mysql_real_escape_string($_POST['Driver1']);
$second=mysql_real_escape_string($_POST['Driver2']); 



//var_dump($_SESSION);
    $query="INSERT INTO perrace(perraceid, SubmissionId, Race, Driver1, Driver2, time_updated, updated_dt) VALUES ('', '$ud_ID','$Race1','$first','$second','CURDATE()','')";
   

mysql_query($query)or die(mysql_error());
if(mysql_affected_rows()>=1){
    echo "<p>$TeamName Your options have been updated please login again to see <p>";
   	

    echo "<p><b><a href='../log.php'>Login</a></b></p>"; 
}else{
    echo "<p>Sorry $TeamName Sorry nothing was updated<p>";
}
?>

what i would love is for it to check that race and submissionID is not already in database
SOLUTION
skullnobrains

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 4 Answers and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros