close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Can't Insert or Update Records

Thread began 3/11/2016 6:51 pm by Philip | Last modified 3/15/2016 5:03 pm by Ray Borduin | 247 views | 9 replies |

Philip

Can't Insert or Update Records

I am just getting started with building a website (for the first time) and have run into a roadblock on my admin side. I've created some very basic pages just to test out the functionality and I cannot insert or update any records in my database. I'm able to pull records fine, but when I try to submit the Update (attached as UpdateCode), all of the values reset to the original. Insert, which I created just to see if I could do it and is also attached, just reblanks the fields.

I'm using WAMP as the root user on my own machine. The connection is fine (test works OK and I can get data down from the server).

For the update code, the PlayerID is in fact a string, not an integer (it's a concatenation of first name last name date of birth), and anyway, the insert code is inserting to a database that only has two varchar columns.

UPDATE:

I found multiple problems with both files and have fixed everything I found, but still neither one works.

Sign in to reply to this post

Philip

This post has been deleted.

Ray BorduinWebAssist

Please attach the current version of the files you are working on as .php pages so I can easily look at them. Include any error messages you are getting, or if it just doesn't do anything when the page submits and I'll take a look.

Sign in to reply to this post

Philip

Files are attached as .php.

No errors, just no action.

Thanks!

Sign in to reply to this post

Ray BorduinWebAssist

You need to add : method="post" to your forms.

Sign in to reply to this post

Philip

Thanks, that worked for the insert, but not for the update file. I think at one point early on I had tried that for the update and when it didn't work I changed it back to default and then didn't do anything with it when I made the insert version just to test.

I will say that the update file does insert null values into the columns that were previously blank, so it is doing something, it just won't overwrite the data that is already in the database.

Sign in to reply to this post

Ray BorduinWebAssist

Update the ID reference on line 36 from: $_GET['PlayerID'] to $_POST['PlayerID'] now that your form is posted... also each of the BindColumn bindings should be bound to the Form Variables... you have them all bound to the recordset values which makes no sense.

Sign in to reply to this post

Philip

Thanks so much for putting up with my silliness, since I named each form entry the exact same as each table column, I wasn't able to tell that the list of names on the left side of the dialog referred to the database not the form fields. I am glad at least to be spared the list of embarrassing mistakes I found after my initial posting before anyone saw it.

Unfortunately, changing the second filter reference in the update php to post and rebinding the columns to the form fields didn't make it work. So I guess there is some other dumb mistake I made still in there. I've uploaded a revised file.

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

Ray BorduinWebAssist

It looks good, but I see now that you can update the PlayerID... that means that you actually should be using $_GET['PlayerID'] on line36. Try that. If you were updating the PlayerID in your tests it wouldn't find or update the record since the playerID changed.

Sign in to reply to this post

Philip

Working fine now. Thanks so much for all of your help.

Sign in to reply to this post
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...