close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Fatal error: Cannot redeclare class WA_MySQLi_RS in ...

Thread began 9/02/2015 11:31 pm by stephen287384 | Last modified 9/09/2015 10:17 am by Ray Borduin | 4882 views | 12 replies |

stephen287384

Fatal error: Cannot redeclare class WA_MySQLi_RS in ...

I have built a search results page that also contains refine filtering using AJAX which loads the refined results into a div (Load Plugin to div via framework builder) on the same page. The problem is, i need a MySQLi recordset on the results page (to populate the filters) as well as the refined results framework plugin (to return the refined search results), however i am getting this error because the rsobj.php include is on both pages. This is required by MySQLi to generate the recordsets.

Is there a workaround so I only have to include rsobj.php on one of the pages to avoid the error (Fatal error: Cannot redeclare class WA_MySQLi_RS in ...)?

Sign in to reply to this post

Ray BorduinWebAssist

Make sure the file is included with require_once() so that it won't be repeated.

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

stephen287384

That;s the way I have it setup but it is required on the plugin page as well, otherwise the recordset does not work..This is the error I get if I only require_once() on the results page:

Fatal error: Class 'WA_MySQLi_RS' not found in /home/......./public_html/search_results.php on line 47

Line 47 is the first line of the recordset.

Sign in to reply to this post

Ray BorduinWebAssist

Can I get FTP access to the site and a url to reproduce the problem? I would think it would work if you have require_once in both files, but I'll test to try to determine what the issue is.

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

stephen287384

PM

Sign in to reply to this post

stephen287384

OK I have fixed the errors (I regularly seem to get things working shortly after posting to the support forums), just need to get the filtering to add to the results each time more checkboxes are ticked. For example, if I am filtering by postcode and the postcode checkboxes are populated by a MySQLi recordset, I have 1 binding set to filter the postcodes but if more than 1 checkboxes are ticked, it should add to the results. Can you please advise how this can be achieved?

I understand that if I have different filters in place, eg. by postcode, by price, by star rating etc... then I would just add the additional bindings and add to the SQL query but how do you achieve with 1 binding on dynamically generated checkboxes?

Sign in to reply to this post

Ray BorduinWebAssist

There is an option in the MySQLi recordset parameter that will allow you to pass parameters as "comma separated list". This will allow you to use an IN statement in your query to allow multiple selections like:

SELECT * FROM Table WHERE postalCode IN (param)

then param can be set to allow comma separated lists and then you name all your checkboxes with the same name (with brackets so they are passed as an array) like: name="postalCheck[]"

Then set the parameter value to create a comma separated list from the array like: <?php echo(implode(",",$_POST['postalCheck'])); ?>

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

stephen287384

Man you are GOOOOOOD!

Sign in to reply to this post

stephen287384

One problem, if all the suburb checkboxes are deselected I get this error:

Notice: Undefined index: suburb in /home/....../public_html/filtered_results.php on line 12

Warning: implode() [function.implode]: Invalid arguments passed in /home/........../public_html/filtered_results.php on line 12

Sign in to reply to this post

Ray BorduinWebAssist

Please attach a copy of the page and I'll take a look.

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

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...