This topic is locked

ajax issue

4/16/2009 8:25:50 AM
PHPRunner General questions
G
garethp authorDevClub member

Hi
I have a master detail set up. When I hover over the link on the master page then the details popup. THis is generally great and works perfectly.
However I now have a problem...
I have a list page: before sql query set up on the details page

$strWhereClause = whereAdd($strWhereClause,"activity_users.username ='".$_SESSION["UserID"]."'");


So when I click the link only the records link in the master page only the detail records where activity_user.username = userid are shown - this works great.
However the ajax popup does not utilise this addiontal sql statement and all records are shown - and the number of records for example show 3, when only 1 is seen on the details page.
Any ideas?

J
Jane 4/16/2009

Hi,
you should add this where clause to the SQL query in the generated..._detailspreview.php file.

G
garethp authorDevClub member 4/20/2009

Hi
I have come accross the same issue with the master_list where I have had to add the sql to master_list.php file.
Do you not think it would make sense for the masterlist and details preview to adopt any additional sql scripts from the events? I can not ever think of a reason when you would not want this to happen.
It is a real pain to have to add to the files manually as this causes such problems on rebuilds.
Either this or there need to be a before list: sql for the masterlist and details preview. There may be the same issue with print but I have not checked this.
Take care.

J
Jane 4/21/2009

Hi,
thank you for sharing your ideas.

We'll add these features to our "to-do" list.

G
garethp authorDevClub member 5/11/2009

Hi
Sorry to be stupid - I just can not work out where to add the code in the details preview file to make it work.
I have found where I believe I need to add the code...

//$strSQL = $gstrSQL;

if($mastertable=="activityII")

{

$where ="";

$where.= GetFullFieldName("activity")."=".make_db_value("activity",$_SESSION[$strTableName."_masterkey1"]);

}


but I can not work out where and how to add the addition sql code...

$strWhereClause = whereAdd($strWhereClause,"activity_users.username ='".$_SESSION["UserID"]."'");


Please can you help

Thanks
Gareth

G
garethp authorDevClub member 5/11/2009

Hi
I have got his working - had a brainwave.
However the number of records in the count is incorrect - where can I ammend this as this.
Thanks

J
Jane 5/11/2009

Hi,
find and edit this line:

$rowcount=gSQLRowCount($where,0);


Here is a sample:

$where = whereAdd($where,"activity_users.username ='".$_SESSION["UserID"]."'");

$rowcount=gSQLRowCount($where,0);

G
garethp authorDevClub member 5/11/2009

thanks jane