You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RISE
I used RISE to generate the following php code for creating a new
instance of a 'Contact'. I kept getting an error until I removed the
quotation marks around the table and field names (t_wed_u_Contact and
c_u_Email in the query string. I've included the relevant part of code
and the resulting error:
---
public function NewContact($Email)
{
while ($row = $result->fetch_row()) {
var_dump($row[0]);
}
if(is_null($Email))
throw new Exception('ArgumentNullException: Email');
$sql_stmt = 'INSERT INTO "t_wed_u_Contact"("c_u_Email") VALUES (?)';
$mysqli_stmt = $this->ConnectionResource->prepare($sql_stmt);
---
Fatal error: Uncaught exception 'Exception' with message 'INSERT INTO
"t_wed_u_Contact"("c_u_Email") VALUES (?): prepare statement failed:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '"t_wed_u_Contact"("c_u_Email") VALUES (?)' at line 1'
Cam: @muunkky
unread,
Dec 16, 2009, 4:08:41 PM12/16/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RISE
Oops... I added the while loop while debugging, code should read
> public function NewContact($Email)
> {
> if(is_null($Email))
> throw new Exception('ArgumentNullException: Email');
> $sql_stmt = 'INSERT INTO "t_wed_u_Contact"("c_u_Email") VALUES (?)';
> $mysqli_stmt = $this->ConnectionResource->prepare($sql_stmt);
HOlsen
unread,
Dec 17, 2009, 1:29:36 PM12/17/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to RISE
Hi Cameron, Table names, Column names etc. are quoted in order to allow restricted names and funny characters. The Sql92 standard states that you should use quotation marks.
You need to set your database connection in ANSI sql_mode. $ConnectionResource->options(MYSQLI_INIT_COMMAND, "SET sql_mode = 'ANSI'");
If you generate Web Service code, this is done for you.