Skip to main content
Topic: ERROR 500 in CustomView with Param (Read 1708 times) previous topic - next topic

ERROR 500 in CustomView with Param

Hi

I'm trying to create a custom view with a param.

I've followed suggestions in https://phprad.com/forum/index.php?topic=175.0 by WIllVin
But I still get error 500.
(due to an error in the forum "The upload directory is full. Please contact an administrator about this problem." I cannot post an image)

I've create a simple customView using PHPRad QueryBuilder
Code: [Select]
SELECT  c.idcompany, c.name, c.isExternal, c.descr FROM companies AS c WHERE  (c.idcompany  = ? )
and set the sngle param to 1 entering
Code: [Select]
1
to the first line in the Edit Query Params box
Then
  • Added the custom view to a menu,
  • Saved project and
  • published
navigating to the custom view I get ERROR 500

Navigating to the project APP / CONTROLLER directory using Poect Explorer and opening the controller of the created custom viewI can find these two lines
Code: [Select]
		$sqltext = "SELECT SQL_CALC_FOUND_ROWS   c.idcompany, c.name, c.isExternal, c.descr FROM companies AS c WHERE  (c.idcompany  = ? )";
$queryparams = null;

I expected to find
Code: [Select]
		$sqltext = "SELECT SQL_CALC_FOUND_ROWS   c.idcompany, c.name, c.isExternal, c.descr FROM companies AS c WHERE  (c.idcompany  = ? )";
$queryparams = $db->rawQueryValue($sqltext, array(1));

Yet even modifying the line manually I still get ERROR 500.

I consider it a bug.
How can I fix it?

Best Regards

Re: ERROR 500 in CustomView with Param

Reply #1
Hi @bruce63‍, yeah it is a bug. Instead of using bind parram, why not add the value as part of the query for now until it gets fixed. E.g
Code: [Select]
SELECT  c.idcompany, c.name, c.isExternal, c.descr FROM companies AS c WHERE  (c.idcompany = 1)

 

Re: ERROR 500 in CustomView with Param

Reply #2
Hi WIllVin

thanks for your reply.

I cannot use a fixed value. I've posted a test, with a fixed value to simplify the understanding of the bug.
What I really need is a parameter based on value selection, but due to the complexity of the query I must use it as a parameter of a function in the select, something like
Code: [Select]
SELECT * FROM MyFunction( ? );
where ? will be changed in a date.

is there any timing for the bug fixing?

Re: ERROR 500 in CustomView with Param

Reply #3
@bruce63‍ you can still do the same I just used that as an example for you, but it seems you did not understand me. Here is another example.
Code: [Select]
SELECT  c.idcompany, c.name, c.isExternal, c.descr FROM companies AS c WHERE  (c.idcompany = '".USER_ID."')

Re: ERROR 500 in CustomView with Param

Reply #4
You got it

I didn't understand.

I don't know that notation.
Where can I find the list of system variables?
How can I get the value of a widget and put it into a system variabl (or a variable usable in PHP) like USERID ?

Re: ERROR 500 in CustomView with Param

Reply #5
@bruce63‍ please click on View Helper on the top left corner of the phprad application to see a list of variables and functions that can be used globally.