Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4168 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi, I had a fellow do some work to access our database via our web site which has sort of worked but I'm not entirely sure he knew what he was doing, FM API wise, and he is no longer !   Anyway, there's a number of records which are being listed in creation order even though he's apparently put a  sort order (as we had requested), the following seems to be the relevant code.

 

 

# grab search criteria, if any has been sent
    $criteria1 = htmlspecialchars($_POST['refno']);
    $criteria2 = htmlspecialchars($_POST['claimno']);
    $criteria3 = htmlspecialchars($_SESSION['LinkingID']);
    $criteria4 = htmlspecialchars($_GET['type']);
 
# grab the sort column, if any has been sent
    $column = (array_key_exists('column', $_GET)) ? htmlspecialchars($_GET['column']) : '';
 
-
-  a whole bunch of other code, then
-
 
# specify sort column (aka, field), if any
    $request->addSortRule($column, 1);
 
# execute the search transaction
    $result = $request->execute();
 
 
I'm new to php etc ... I don't understand the need for the $column variable, the need for the array_key_exist function and where the 'column' comes into it.  
 
I've tried changing the $request line to   
 
$request->addSortRule('Date',1) --- the Date field being one I want the sort on
 
but it returns an error 
 

thanks

Posted

This script is apparently the handler for a form from another file. The other file calls this one with a URL that looks something like  

...yourFile.php?column=Date (there might be some other equations after the ? either before or after this one as well, separated by ampersands [&])

 

The column is fetched in your file by the htmlspecialchars($_GET['column']) function. $_GET is an array that contains the code after the question mark in the url; e.g. column=>Date

 

The $column variable first checks if there is a "column=Date" command in the calling path, and if there is, set the variable to that value.  Otherwise, set $column to no value ('').  It appears that the latter is what is happening, because no sort is performed.

 

You have not provided enough information on the data being passed from the form to know why the field Date is not being read into the array of fields being pulled from the FM file.  This is the reason for the failure, not the code you have presented here.

Posted

Thanks doughemi

 

there is no 'column' in the parameters being passed just:-

 

cases.php?claimno=123&refno=114577&chk_pass2=Go

 

if I manually type in &column=Date at the end it still doesn't work 

 

is the syntax of the my $request->addSortRule('Date',1) correct ?  .. if so not sure why it's not working  

 

 

might have to find another programmer ! 

Posted

Would need the full code of both the original page and the handler page to work out what is going on and how it may be fixed...

Posted

is the syntax of the my $request->addSortRule('Date',1) correct ?  

 

Only if the field Date is in the array constructed by the newFindCommand() function.  As webko says, we would need to see both php files to be able to find out.  It sounds to me like it might be a more formidable problem than can be solved on an internet forum.

Posted

OK, thanks, think I'll stick to the file side scripting and find a new developer for the web side stuff

This topic is 4168 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.