I'm having a problem to insert data from php to database.
File is: Patient.php
Table name is: patient_tbl
inside of table is: avatar and education
here is inserting code: There is no problem with this following code, value of 'education' will be inserted to table
$sql = "INSERT INTO " . $this->_table;
$sql .= "education,";
$params = array(
urlencode($patient->getEducation()),
);
return $this->exec($sql, $params);
}
But now here is my problem, "Avatar" don't insert to table
The error message is: "Unable to prepare query."
$sql = "INSERT INTO " . $this->_table;
$sql .= "education, avatar, ";
$params = array(
urlencode($patient->getEducation()),
urlencode($patient->getAvatar()),
);
return $this->exec($sql, $params);
}
What's my prblem? I can't find a solution for this,.
I really appreciate your help.
Thank you
,in your second query will cause a syntax error.$sqland include it in the question. My guess is that the answer will be obvious (such as as the lack of parentheses around the column names).