Thanks for the reply, I had changed the query to this ad it removed the error, but still didnt actually add the data to the database 😕
function gettreatmentid($first, $last, $date){
global $conn;
$q = "SELECT treatmentid FROM treatments WHERE firstname = '$first' && lastname = '$last' && date = '$date'";
$result = mysql_query($q,$conn);
return $result;
}
And about the SQL injections, i have them on all my other form inputs, this isnt placed live though until it works 🙂
Should i still try replacing && with AND?
Edit: though i would add the fnction that actually inserts the data into the database:
function addfeedback($username, $treatmentid, $date, $firstname, $lastname, $general24, $general3, $general1, $specific24, $specific3, $specific1, $explanation, $relevant, $didithelp, $enjoyable, $notes, $opinion){
global $conn;
$q = sprintf("INSERT INTO feedback VALUES ('', '$username', '$treatmentid', $date', '$firstname', '$lastname', '$general24', '$general3', '$general1', '$specific24', '$specific3', '$specific1', '$explanation', '$relevant', '$didithelp', '$enjoyable', '$notes', '$opinion')",
mysql_real_escape_string($username, $conn),
mysql_real_escape_string($treatmentid, $conn),
mysql_real_escape_string($date, $conn),
mysql_real_escape_string($firstname, $conn),
mysql_real_escape_string($lastname, $conn),
mysql_real_escape_string($general24, $conn),
mysql_real_escape_string($general3, $conn),
mysql_real_escape_string($general1, $conn),
mysql_real_escape_string($specific24, $conn),
mysql_real_escape_string($specific3, $conn),
mysql_real_escape_string($specific1, $conn),
mysql_real_escape_string($explanation, $conn),
mysql_real_escape_string($relevant, $conn),
mysql_real_escape_string($didithelp, $conn),
mysql_real_escape_string($enjoyable, $conn),
mysql_real_escape_string($notes, $conn),
mysql_real_escape_string($opinion, $conn));
}