close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic select list not populating from database

Thread began 4/20/2016 11:44 am by tmcbinc99963 | Last modified 4/29/2016 9:10 am by Ray Borduin | 1485 views | 8 replies |

tmcbinc99963

Dynamic select list not populating from database

I'm adding a dynamic select list to an existing search results form, allowing the customer to select a product size from the results, then submit to an eCart checkout page.

First, the select list won't populate the product sizes from the recordset.

Second, the select list has created a search result that shows only the first entry from the database multiple times. When the select list is deleted, the results display correctly.

Sign in to reply to this post

Ray BorduinWebAssist

You are trying to populate the select list from the same recordset you are displaying the results from... usually you would create a second recordset to populate the select list and nest that recordset inside the repeated region so that each row would have it's own results.

Sign in to reply to this post
Did this help? Tips are appreciated...

tmcbinc99963

A separate recordset has been created, along with a repeat rows behavior.

I'm using the Property Inspector 'bind to dynamic source' panel to populate the select list. The menu shows every record in the Db, rather than only those associated with the product.

Sign in to reply to this post

Ray BorduinWebAssist

You need to move the recordset code from lines 116-120 down inside the repeated region after what is currently line 551 so that it is recreated for each product.

Then you need to filter the recordset using the productID so that it only shows records for the current row. To do that, filter the recordset using a URL parameter ProductID and then add this row above the recordset:

<?php
$_GET['ProductID'] = $row_WADAProd['ProductID'];
?>

Sign in to reply to this post
Did this help? Tips are appreciated...

tmcbinc99963

When the recordset code is moved inside the repeating region, I get the following error:

Notice: Undefined variable: ProdSizeSelectList in /Applications/MAMP/htdocs/primrose.com/Prod_results.php on line 678
Warning: mysql_free_result() expects parameter 1 to be resource, null given in /Applications/MAMP/htdocs/primrose.com/Prod_results.php on line 678.

Also, when trying to filter the advanced INNER JOIN recordset, I copied an earlier simple recordset that was filtered using the URL Parameter and ID, then clicked advanced, and added the INNER JOIN text back in. I keep getting a syntax error in the WHERE clause on the colname variable default value. I've tried -1, 1 and ID, but still get the error.

File and recordset image attached.

Sign in to reply to this post

Ray BorduinWebAssist

You moved it into the wrong repeat region... it should be just after line 546.

I don't see the where clause or parameter in the recordset at all, so I can't comment on what was wrong with it in your tests... but it sounds like you may not have typed in the correct parameter name to match the placeholder in the SQL when you added it.

Sign in to reply to this post
Did this help? Tips are appreciated...

tmcbinc99963

It still gives me the same error message after moving the code, and multiple records don't show up in the select list. It also doesn't show the appropriate sizes for each product.

SELECT *
FROM Prod INNER JOIN ProdType ON ProdType.TypeID = Prod.ProdType INNER JOIN ProdSize ON Prod.ID = ProdSize.ProdSizeID INNER JOIN ContSize ON ProdSize.ContSizeID = ContSize.ContID
WHERE ID = colname
GROUP BY ID

colname type: integer
default value: -1
run-time value: $_GET['ID']

File attached.

Sign in to reply to this post

Ray BorduinWebAssist

This looks correctly placed. What is the current error that you get on the page?

If you test that SQL statement in PHP MyAdmin do you get the results you expect (replacing the parameter with a valid ID from the products table of course)?

Sign in to reply to this post
Did this help? Tips are appreciated...

tmcbinc99963

The error was in the SQL statement. The product size table wasn't properly configured to pick up the URL.

Thanks for your help.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...