on_insert

Questionson_insert
Candice asked 10 years ago

I have a full version of PHP Grid (version 1.5.2). When I changed my PHP Grid config file use to mysqli, the call to a stored procedure in my custom 'on_insert' function stopped working. It is set up like this:

$query = "CALL sp_insert_stored_proc('$field1', '$field2', '$field3')";
mysql_query($query) or die (mysql_error);

(the real parameters for '$fieldx' above are set up by using the
$data["params"]["fieldname"] calls)

Should something else be changed in the function to make this insert work once I begin using mysqli?

Thank you.

4 Answers
Candice answered 10 years ago

And one additional piece of information, it does not display an error message, it just does not update the row.

Abu Ghufran answered 10 years ago

To see the message, you need to set:
phpgrid_error( mysql_error() );

You can also see message from ajax response. Use firebug to see the ajax post response.
https://phpgrid.desk.com/customer/portal/articles/926266

Candice answered 10 years ago

Abu,

I got this error:

Access denied for user ''@'localhost' (using password: NO)

I created a second connection file that is exactly the same as the 'mysql' connection file in every respect except for the 'db_type' parameter (mysqli v. mysql).

Thank you.

Abu Ghufran answered 10 years ago

Hi,

I am unable to generate this issue.
Please share the code for review (can use pastebin.com)

Mysqli code sample:
http://phpgrid.org/demo/demos/loading/db-layer-mysqli.phps

Same works with config type 'mysql'

Your Answer

5 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?