i have a php file that sends data to a mysql database. when i try to send the data get this:
ERROR! EMPTY RESULTINSERT INTO email (First, Last, Full, Email, CountryCoude, Phone, Company, Serial) VALUES ('','',' ','[email protected]',,,'Webscan, Inc.','TEST mySQL')[email protected]+1303-459-4521Webscan, Inc.TEST mySQL
as you can see from the output, the variables i put into my insert function are not empty but the values being sent in the query are. why is this?
non-confidential part of the php file:
insert($firstname,$lastname,$email,$countrycode,$phonenumber,$companyname,$serialnumber);
$result = mysql_query("SELECT DISTICT * FROM email");
if (empty($result)) {
echo "ERROR! EMPTY RESULT";
}
else {
print_r($result);
}
echo "INSERT INTO email (First, Last, Full, Email, CountryCoude, Phone, Company, Serial)
VALUES ('".$first."','".$last."','".$first." ".$last."','".$email."',".$code.",".$phone.",'".$company."','".$serial."')";
echo $firstname.$lastname.$email.$countrycode.$phonenumber.$companyname.$serialnumber;
?>
</div>
</div>
</body>
<?php
function insert ($first, $last, $email, $code, $phone, $company, $serial) {
mysql_query("INSERT INTO email (First, Last, Full, Email, CountryCoude, Phone, Company, Serial)
VALUES ('".$first."','".$last."','".$first." ".$last."','".$email."',".$code.",".$phone.",'".$company."','".$serial."')");
}
?>
mysql_real_escape_string(), or using prepared statements. Other than the fact that it doesn't work, that's your biggest problem.