A
|
alang 2/1/2009 |
As a suggestion, I would have thought you should have a WHERE clause in your SQL. Currently you appear to be selecting all records from the rlistings table and then only checking the "showimages" field from the first record. |
K
|
kjonmyway author 2/1/2009 |
My query and the associated code is actually more complicated. I just used an example of what I was trying to do, because the query is not the issue, it is the display of the field in the List, and Edit pages that is the issue. |
![]() |
hichem 2/2/2009 |
I have searched and searched, and can't figure out what I am doing wrong. I need to alter the view, list and edit pages for a conditional statement. I have a table with a field named showimages, with a possible value of yes or no. I also have a field of img1, img2, img3 with filenames. Before the view, list and edit pages are processed, I would like to check if the value of showimages is yes, and if it is, display the img1, img2 and img3 fields, and if not, don't display them. In the View Page, Before Display (same with edit and list pages) I have this in the Table Events - [codebox]global $conn; $strSQLExists = "select * from rslistings"; $rsExists = db_query($strSQLExists,$conn); $data=db_fetch_array($rsExists); if($data['showimages']=='yes') { $xt->assign("img1_fieldblock",true); $xt->assign("img2_fieldblock",true); $xt->assign("img3_fieldblock",true); } else { $xt->assign("img1_fieldblock",false); $xt->assign("img2_fieldblock",false); $xt->assign("img3_fieldblock",false); }[/codebox] This seems to work for the List page, but not for the Edit and View pages, the fields display no matter what. Any help is GREATLY appreciated.
|
K
|
kjonmyway author 2/2/2009 |
Thank you so much for taking the time to respond! Although I will definitely wait to get input from Jane, I really appreciate you taking the time to post this - it makes sense. |