Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

"Creating PHP Code" issue

Locked
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

"Creating PHP Code" issue

Unread post by ruiascensao »

Hi,

I have use the PHP code of nuBuilderPro documentation to do a test:

Code: Select all

$sql = "SELECT * FROM customer WHERE customer_id = '1'";
$qry = nuRunQuery($sql);
$obj = db_fetch_object($qry);

print " customer name: $obj->cus_name
customer phone: $obj->cus_phone
customer email: $obj->cus_email";
When I run this code I get the following error on the zzzsys_debug table:

Code: Select all

===USER==========



===PDO MESSAGE=== 

SQLSTATE[42000]: Syntax error or access violation: 1064 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 'WHERE  = '53566d4e5e43280'' at line 1

===SQL=========== 

SELECT * FROM  WHERE  = ? 

===BACK TRACE====

/data/intranet/pybrequests/nucommon.php - line 500 (nuRunQuery)

/data/intranet/pybrequests/nucommon.php - line 458 (nuRecordArray)

/data/intranet/pybrequests/nuapi.php - line 16 (nuHashData)
This happens with other queries that I try to run.

Could you please advise id using "nuRunQuery($sql)" is the issue?

Thank you.
BR
Rui
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: "Creating PHP Code" issue

Unread post by massiws »

Rui,
  1. where you put that code?
  2. are you sure customer table exists in your database?
  3. are you trying to send email? If yes, you must set configuration parameters in System Setup -> Email Settings
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: "Creating PHP Code" issue

Unread post by ruiascensao »

Hi massiws ,
1. where you put that code?
php1.JPG
php2.JPG
2. are you sure customer table exists in your database?
cus_table.JPG
3. are you trying to send email? If yes, you must set configuration parameters in System Setup -> Email Settings
No, I'm not.

Thank you for your support.
You do not have the required permissions to view the files attached to this post.
BR
Rui
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: "Creating PHP Code" issue

Unread post by ruiascensao »

Hi massiws,

I also have an error message when I "RUN PHP CODE":

Code: Select all

There has been an error on this page.
 Please contact your system administrator and quote the following number: 0
BR
Rui
Fike
Posts: 79
Joined: Thu Oct 20, 2011 9:13 pm

Re: "Creating PHP Code" issue

Unread post by Fike »

Hi Rui,

I think I also got that message.

In the image php1.jpg that you posted I can see that you have not filled the 'Criteria form' lookup object.

Fill it (choose the blank form) and try to run the php code again.

Hope this helps,

Fike
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: "Creating PHP Code" issue

Unread post by ruiascensao »

Hi Fike,

It works when adding on the "Criteria Form" a Blank form.

Thank you for the help!!
BR
Rui
Fike
Posts: 79
Joined: Thu Oct 20, 2011 9:13 pm

Re: "Creating PHP Code" issue

Unread post by Fike »

You are welcome!

I am glad it worked.

Fike
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: "Creating PHP Code" issue

Unread post by admin »

.
Locked