close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

addfilter

Thread began 4/06/2022 11:07 am by birdscreen398247 | Last modified 4/06/2022 2:46 pm by Ray Borduin | 449 views | 10 replies |

birdscreen398247

addfilter

On line 21 of the attached file, I am trying to filter on two fields, one of which involves a substring.

I am getting
"Recoverable fatal error: Object of class WA_MySQLi_RS could not be converted to string in /home/w72w9xoqmrbx/public_html/webassist/mysqli/queryobj.php on line 340."

What is the correct syntax for what I am trying to do?

Attached Files
UpdateCompletedDates.php
Sign in to reply to this post

Ray BorduinWebAssist

On line 19 you have:
$UpdateQuery->Table = $rsTemp;

That should be a table name like:
$UpdateQuery->Table = "PORC_decisions";

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

birdscreen398247

Whoops, I forgot I tried a different approach earlier and forgot to change it back.

I changed the table name, and no longer get any errors, but it is not updating the table.

Is my syntax correct on the substring, etc.

I am trying to extract 2020 out of 1234_2020_1234 and also filter on PORC_class great than "".

$UpdateQuery->addFilter("substring(record_number,6,4)", "=", "s", "".((isset($_POST["UpdateYear"]))?$_POST["UpdateYear"]:"") ." AND PORC_class>''");

Sign in to reply to this post

Ray BorduinWebAssist

No, that is not correct.

addFilter(column,comparison,type,value);

So the first argument should be a column name.

You can't add an AND to do multiple column comparisons you should add multiple addFilter() rows.

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

birdscreen398247

So is there anyway to filter on substring(record_number,6,4)?

Sign in to reply to this post

Ray BorduinWebAssist

Yes, that would be the filter value. You have it in the place of the column name.

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

birdscreen398247

So...

$UpdateQuery->addFilter("record_number", "=", "s", "".substring(record_number,6,4) = ((isset($_POST["UpdateYear"]))?$_POST["UpdateYear"]:"");

?

Sign in to reply to this post

Ray BorduinWebAssist

That doesn't look right. I'm not sure what you are trying to do with the value:

"".substring(record_number,6,4) = ((isset($_POST["UpdateYear"]))?$_POST["UpdateYear"]:""

Where does the UpdateYear posted value come in?

I would think it would be something like:
$UpdateQuery->addFilter("record_number", "=", "s", "".substring(record_number,6,4) ."");

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

birdscreen398247

I want to update the records where substring(record_number,6,4) is equal to the $_POST["UpdateYear"]

Not filter on the whole "record_number" field.

That is easily done in Visual Basic for Access, but sql doesn't seem to accommodate that.

Sign in to reply to this post

Ray BorduinWebAssist

I think I'll need a phone call to understand what you are trying to do.

I'm starting to understand though... It might be:

$UpdateQuery->addFilter("substring(record_number,5,4)", "=", "s", "".((isset($_POST["UpdateYear"]))?$_POST["UpdateYear"]:"") ."");

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