Page 1 of 1

"Creating PHP Code" issue

Posted: Tue Apr 22, 2014 5:27 pm
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.

Re: "Creating PHP Code" issue

Posted: Wed Apr 23, 2014 2:13 am
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

Re: "Creating PHP Code" issue

Posted: Wed Apr 23, 2014 10:38 am
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.

Re: "Creating PHP Code" issue

Posted: Wed Apr 23, 2014 11:56 am
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

Re: "Creating PHP Code" issue

Posted: Wed Apr 23, 2014 12:19 pm
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

Re: "Creating PHP Code" issue

Posted: Wed Apr 23, 2014 1:40 pm
by ruiascensao
Hi Fike,

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

Thank you for the help!!

Re: "Creating PHP Code" issue

Posted: Wed Apr 23, 2014 7:55 pm
by Fike
You are welcome!

I am glad it worked.

Fike

Re: "Creating PHP Code" issue

Posted: Thu Apr 24, 2014 5:18 am
by admin
.