This topic is locked
[SOLVED]

 Event on "List Page: Custom Query" don't Work

6/29/2010 9:07:01 PM
PHPRunner General questions
S
Seraph author

Hi,

In event tab: "List Page: Custom Query" I have these parameters:

------------------------------------------------------------------------------

Parameters

$searchObj - Instance of a class which performes search

$orderBy - Array with field order

$howOrderBy - Array with sort type for 'orderBy' array

$masterTable - Master table name

$masterKeysReq - Array of keys

$selectedRecord - Array of selected records on Print Page, null on List Page

$pageSize - Number of records per page

$myPage - Current page number

------------------------------------------------------------------------------
I did only:
$pageSize = 10;
But when I build the progect and open the list page I receive this error:
Error type 2

Error description mysql_fetch_array(): supplied argument is not a valid MySQL result resource

URL "MySite"/STELLAMARIS_V_VISITS_list.php?

Error file "MySite"/include/dbconnection.php

Error line 70

SQL query select count(*) FROM MyTable
File: line Function Arguments

0. include/dbconnection.php:70 mysql_fetch_array 1. ;

  1. 1;

    1. include/dbconnection.php:70 db_fetch_array 1. ;

    2. classes/listpage.php:1828 ListPage->beforeProccessRow N/A

    3. classes/listpage.php:1938 ListPage->fillGridData N/A

    4. classes/listpage.php:2563 ListPage->prepareForBuildPage N/A

    5. STELLAMARIS_V_VISITS_list.php:92 Global scope N/A


    Anyone know the cause?

    Thank you very much
    (I tried also to delete all instruction on this event page but I receive always same error)



S
Seraph author 6/29/2010



Hi,

In event tab: "List Page: Custom Query" I have these parameters:

------------------------------------------------------------------------------

Parameters

$searchObj - Instance of a class which performes search

$orderBy - Array with field order

$howOrderBy - Array with sort type for 'orderBy' array

$masterTable - Master table name

$masterKeysReq - Array of keys

$selectedRecord - Array of selected records on Print Page, null on List Page

$pageSize - Number of records per page

$myPage - Current page number

------------------------------------------------------------------------------
I did only:
$pageSize = 10;
But when I build the progect and open the list page I receive this error:
Error type 2

Error description mysql_fetch_array(): supplied argument is not a valid MySQL result resource

URL "MySite"/STELLAMARIS_V_VISITS_list.php?

Error file "MySite"/include/dbconnection.php

Error line 70

SQL query select count(*) FROM MyTable
File: line Function Arguments

0. include/dbconnection.php:70 mysql_fetch_array 1. ;

  1. 1;

    1. include/dbconnection.php:70 db_fetch_array 1. ;

    2. classes/listpage.php:1828 ListPage->beforeProccessRow N/A

    3. classes/listpage.php:1938 ListPage->fillGridData N/A

    4. classes/listpage.php:2563 ListPage->prepareForBuildPage N/A

    5. STELLAMARIS_V_VISITS_list.php:92 Global scope N/A


    Anyone know the cause?

    Thank you very much
    (I tried also to delete all instruction on this event page but I receive always same error)




I resolved editing (after build project) file: "output\include\MYTABLE_events.php" adding the "&" and the "return false"
// List page: Custom Query

function ListQuery($searchObj,$orderBy,$howOrderBy,$masterTable,$masterKeysReq,$selectedRecord,[size="2"]&[/size]$pageSize,$myPage)

{

$pageSize=10;

[size="2"]return false;[/size]

;

} // function ListQuery
But this is a bug ? that's no sense

A
ann 6/30/2010

Hi,
usually ListQuery event is used in binding with the ListFetchArray event to change initial SQL query and re-write values in the table on the list page.

To change $pagesize variable proceed to the Miscellaneous tab and set up Records per page option as desired.

S
Seraph author 7/1/2010



Hi,
usually ListQuery event is used in binding with the ListFetchArray event to change initial SQL query and re-write values in the table on the list page.

To change $pagesize variable proceed to the Miscellaneous tab and set up Records per page option as desired.


But if I need conditional for something?

(for example for user that watching)

A
ann 7/2/2010

Hi,
use List page: Before record processed event to set up page size on some condition.

Here is a sample:

if (Condition){

$_SESSION["TableName_pagesize"] = 10;

}



where TableName is your actual table name.