Help spotting mysql/php errror please

Associate
Joined
27 Mar 2010
Posts
1,890
noob first time programmer here, Think i've made a mistake here somewhere but can't spot it! Really appreciate any help i get!

Code:
if (isset($_POST['submit'])){
    
    $name=mysql_real_escape_string($_POST['name']);
    $email=mysql_real_escape_string($_POST['email']);
    $ClanTag=mysql_real_escape_string($_POST['ClanTag']);
    $LicenseCount=mysql_real_escape_string($_POST['LicenseCount']);
    $BillDate=mysql_real_escape_string($_POST['BillDate']);
    
    mysql_query("INSERT INTO Customers (Name, Email, Clan_Tag, License_Count, Bill_Date) 
            VALUES ('$name', '$email', '$ClanTag', '$LicenseCount', '$BillDate')");
   ?>
<p> Entry successful! <p/>
<head>
<meta http-equiv="refresh" content="1;url=input.php">
</head>    
<?php
}
else{ ..................
 
Assuming the error is that the data is not being entered into the database:
Try replacing
Code:
mysql_query("INSERT INTO Customers (Name, Email, Clan_Tag, License_Count, Bill_Date) 
            VALUES ('$name', '$email', '$ClanTag', '$LicenseCount', '$BillDate')");
   ?>
with
Code:
$sql = "INSERT INTO Customers (Name, Email, Clan_Tag, License_Count, Bill_Date) 
            VALUES ('$name', '$email', '$ClanTag', '$LicenseCount', '$BillDate')";
$result = mysql_query($sql);
echo '<br> Your query was - '";
echo $sql;
echo '"<br>The error given is - ';
print_r(mysql_error);
   ?>

That should give you some ideas
 
Back
Top Bottom