close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

conditional updating

Thread began 1/10/2022 8:32 am by birdscreen398247 | Last modified 1/11/2022 1:34 pm by Ray Borduin | 16 views | 5 replies |

birdscreen398247

conditional updating

I have a form with two fields tied to the same table field.

One is a display of the current value, the other is a dropdown list to select a new value.

On the form, only one of those fields is displayed based on the content of the table field.

In the update query, I want to designate which form field to bind based on the same criteria I use to display those fields.

Lets say the table name is PORC_dates and the field is date1 and the two form fields in question are datepicker1 and currentdate1.

If PORC_dates.date1 already has data in it, I don't want to update it at all. But if it has no data, then update it from datepicker1.

Is that possible?

Sign in to reply to this post

Ray BorduinWebAssist

Everything is possible. It sounds like you would need a few IF statements. It might be easier to set a variable above the insert code to get the value you want updated. If you attach the page you are working on I could take a look and give you sample code. It is a bit too complex to talk about generally and expect you to implement it.

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

birdscreen398247

See attached file.

I want to update PORC_decisions.batch_date depending on the following.

If PORC_decisions.batch_date already has a date in it, do nothing.

If PORC_decisions.batch_date is blank, update it from the form-select-field "batchdate."

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

Ray BorduinWebAssist

I think you can just update line 27 to:

$UpdateQuery->bindColumn("batch_date", "t", "".($rsBatchDates->getColumnVal("Batch_Date")?"":$_POST["batch_date"]) ."", "WA_IGNORE");

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

birdscreen398247

When I run that code, I get "there is an error in your SQL"

I have since changed the code to"

$UpdateQuery->bindColumn("batch_date", "t", "".($rsDecisions->getColumnVal("batch_date")?"":$_POST["batch_date"]) ."", "WA_IGNORE");

As the field to check is $rsDecisions->getColumnVal("batch_date"") rather than the rsBatch_dates one.

Now when I submit, it just goes to a blank page (without updating).

Sign in to reply to this post

Ray BorduinWebAssist

Is the rsDecisions recordset code above the Update code? If you attach the page I can see the code and answer your questions more efficiently.

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

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