close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Insert query

Thread began 3/09/2022 6:21 am by birdscreen398247 | Last modified 3/09/2022 1:20 pm by Ray Borduin | 149 views | 3 replies |

birdscreen398247

Insert query

I want an insert query to run only if the record doesn't already exist.

In the attached file, the insert query starts at line 135. The relevant field is record_number (which is a key field).

I have a recordset at line 65 that looks for a record with that number (nit sure if this is a way to do it).

So, if a record already exists with a matching record_number, then don't do the insert.

Right now, I am getting a "There is an error in SQL syntax" error message, which I think is from this insert query because of the conflicting key values.

How do I do this?

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

Ray BorduinWebAssist

You could wrap your insert code in:

if ($rsDecisions->TotalRows == 0) {
// insert code here
}

That way it won't run if the recordset checking for duplicates has a record in it.

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

birdscreen398247

I had the GoTo page in the Insert Query.

Since the insert query is now conditional, I put it in the Form Action property instead.

Now the update query doesn't update.

Where can I put this so both the update and insert queries work (when conditions are met)?

Sign in to reply to this post

Ray BorduinWebAssist

Move the goto to the Update and then move the insert above the update.

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