Skip to main content
Known Participant
April 6, 2009
Question

Search pages

  • April 6, 2009
  • 2 replies
  • 2782 views

I have a master detail page which is sorted and shows 30 records at a time.  One of the columns holds Session records for tennis instruction.  The client wishes to be able to click a button to display only selected items from that column.  I figured a Search page is now in order.

Here's what I've done so far to accomplish this:

Duplicated admin_master.php (page where all the records currently display), named it admin_results.php (page to hold the results) so it would look like the admin_master.php page but with filtered results.

<<admin_master.php>>

Added a form to admin_master.php

Form name is SearchForm, Action is admin_results.php

Added List/Menu form item, name = Session

Added every existing records that Session has in it b/c I couldn't get them to auto-populate using Dynamic (will address later)

Added Submit button

Saved and Uploaded

<<admin_results.php>>

Altered Recordset rs_master, All columns, Filter: Session = URL Parameter Session

Tested Filter by clicking Test and entered a known good record.  Comes up with proper number of records everytime

Saved and Uploaded

<<testing on the website>>

Go to admin_master.php and select one of the ListMenu Items and click Submit

Get following error:  Fatal error: Can't use function return value in write context in /home/shortcou/public_html/admin_results.php on line 133

Line 133 from admin_results.php

$totalPages_rs_master = ceil($totalRows_rs_master/$maxRows_rs_master) = 30;

* Note:  The admin_results.php page was copied from admin_master.php which had the First, Next, Previous, Last behaviors but I removed those cleanly via the (-) on the Behaviors tab.

**  If I created a new page for the results it works fine, but I need to understand why this particular error (which shows up on numerouse pages after making changes) always occurs and how to fix it so I don't have to keep building new pages.

This topic has been closed for replies.

2 replies

SJurickAuthor
Known Participant
April 6, 2009

Found the issue.

Compared new page with error page and noticed that the line 133 ($totalPages_rs_master = ceil($totalRows_rs_master/$maxRows_rs_master) = 30;) was not in the new page.

Deleted it and it works fine.

Now I need to know how to get my List to auto-populate with existing table values instead of having to manually enter them so they are always current.

Thanks,

Steve

David_Powers
Inspiring
April 6, 2009
$totalPages_rs_master = ceil($totalRows_rs_master/$maxRows_rs_master) = 30;

Not sure that I follow everything you're trying to do, but the preceding line is logical nonsense. $totalPages_rs_master must be either 30 or the ceiling of $totalRows_rs_master divided by $maxRows_rs_master, but it can't be both.

I suspect this is what you mean:

$totalPages_rs_master = ceil($totalRows_rs_master/$maxRows_rs_master);
SJurickAuthor
Known Participant
April 7, 2009

Yes I agree.  I have frequent errors on many pages after changing things and they all point to the line (I think someone else in this forum just posted a similar issue).  The first time it happened I had changed the number of records displayed from 10 to 20 and got that error.  Deleted that line that the error referrenced and then it worked.  I've grown to learn that DW sometimes does not always clean out the code after a change, but you have to know where to look.

So on to my next question on Searching:

How do I get the List/Menu to auto-populate with the items from the Session field in rs_master?

From the List/Menu properties:

I choose Options from recordset, then choose the recordset

Values: Session

Labels: Session

Select value equal to: <empty> but I've tried selecting field called Session

Thanks,

Steve

David_Powers
Inspiring
April 7, 2009

I have frequent errors on many pages after changing things

It sounds as though you're making the classic mistake of deleting dynamic objects in Design view instead of using the Server Behaviors panel to remove things cleanly. Select the dynamic object you want to remove in the Server Behaviors panel, and click the minus button. Page navigation inserts a lot of dynamic objects, and you need to make sure you remove all of them.

How do I get the List/Menu to auto-populate with the items from the Session field in rs_master?

You have identified the correct steps. "Select value equal to" is for setting the selected="selected" attribute in the <option> tag that you want displayed - this is typically used for an update form, where you want to display the currently stored value.

If the menu isn't being automatically populated, it sounds as though there are no results. This could happen if you have already used a repeat region to loop through the recordset results. If that's the case, you need to reset the recordset using mysql_data_seek() like this:

mysql_data_seek($rs_master, 0);