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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

insert data into DB using a form

Thread began 7/28/2016 11:58 am by Rosemary | Last modified 8/23/2016 12:23 pm by Ray Borduin | 175 views | 13 replies |

Rosemary

insert data into DB using a form

I've bound the form field to the database using the WebAssist. But the information does NOT go into the database. Trying to find tutorials on this site is impossible as I keep getting error 500, page not found when I click on the links.

Sign in to reply to this post

Ray BorduinWebAssist

The issue with the tutorials page has been resolved. I'd need to look at your page to see why it might not be working.

Sign in to reply to this post

Rosemary

Inserting images into DB using a form

Thank you. I figured out how to insert text into the db using my form. Now, I was hoping to find a way to "browse" the computer to upload an image to the db, so that when the web page is constructed from info pulled from the db that images can be displayed. Do you have a video describing how to do that??

I cannot get the dynamic list to add information into the table from a drop down. I've tried every possible combination.
IF you can see the screen shot, you can see I either get the manufacturer ID to be "0" or "89". I have no idea why 89.
Rosemary

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

Ray BorduinWebAssist

You can add an input type="file" field and use the upload file server behavior to upload a file to a folder on your server and then save the name of the file into your database so you can display it where you need to.

The value must be coming from the select list. I couldn't tell you where the value was coming from without being able to look at the page in a browser and getting a copy of it so I can see the source code.

Sign in to reply to this post

Rosemary

Using Dynamic List (menu/select)

Code for attempting to add products to a DB -- Friday I was getting products to ADD, but they all had the same ID for manufacturer (89). Now...that I've messed up everything, I can't get products to add at all.

I've tested the connection to the DB, it works as I can add users and they do go into the DB, but products will not. Attached are screen shots, and code. I've tried every combination I can think of....broke phpMyAdmin.....(got that working again).

I just don't know how to get this to work. Please give advice.


Rosemary

Attached Files
add products using dynamic list.php
Sign in to reply to this post

Ray BorduinWebAssist

I noticed is that you have the value for man_id set to the recordset result for man_name. That would probably prevent the insert since it is setting a numeric column to a text value.

I think it should be set to the form element "select".

So this line:
$InsertQuery->bindColumn("man_id", "s", "".($rs_man->getColumnVal("man_name")) ."", "WA_DEFAULT");

should look more like:
$InsertQuery->bindColumn("man_id", "s", "".((isset($_POST["select"]))?$_POST["select"]:"") ."", "WA_DEFAULT");

Sign in to reply to this post

Rosemary

I was so excited. I thought that was the breakthrough.
Unfortunately....it still doesn't work. SO, I tried just taking the manufacturer row out....and still didn't go into the db. I guess I should start from scratch as I obviously have mucked this up too much.

Sign in to reply to this post

Ray BorduinWebAssist

I wouldn't start from scratch.... try this:

after this line:

$InsertQuery->execute();

which is the line that tries to do the insert, add this code:

var_dump($InsertQuery);
die();

That will give you more information about the attempted insert including any errors.

Sign in to reply to this post

Rosemary

This is the result of the var_dump:

object(WA_MySQLi_Query)#5 (19) { ["Connection"]=> object(mysqli)#1 (19) { ["affected_rows"]=> int(-1) ["client_info"]=> string(79) "mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $" ["client_version"]=> int(50011) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["field_count"]=> int(0) ["host_info"]=> string(20) "localhost via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(6) "5.7.11" ["server_version"]=> int(50711) ["stat"]=> string(137) "Uptime: 93411 Threads: 1 Questions: 2004 Slow queries: 0 Opens: 180 Flush tables: 1 Open tables: 179 Queries per second avg: 0.021" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(284) ["warning_count"]=> int(0) } ["Statement"]=> string(231) "INSERT INTO product (man_id, prod_name, prod_details, prod_moreInfo, prod_pdf, prod_image, prod_altText, prod_image1, prod_altText1, prod_image2, prod_altText2, prod_active, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ["Action"]=> string(6) "insert" ["Table"]=> string(7) "product" ["Filter"]=> string(0) "" ["SaveAs"]=> string(0) "" ["ParamTypes"]=> array(13) { [0]=> string(1) "s" [1]=> string(1) "s" [2]=> string(1) "s" [3]=> string(1) "s" [4]=> string(1) "s" [5]=> string(1) "s" [6]=> string(1) "s" [7]=> string(1) "s" [8]=> string(1) "s" [9]=> string(1) "s" [10]=> string(1) "s" [11]=> string(1) "s" [12]=> string(1) "s" } ["ParamColumns"]=> array(13) { [0]=> array(2) { [0]=> string(6) "man_id" [1]=> bool(false) } [1]=> array(2) { [0]=> string(9) "prod_name" [1]=> bool(false) } [2]=> array(2) { [0]=> string(12) "prod_details" [1]=> bool(false) } [3]=> array(2) { [0]=> string(13) "prod_moreInfo" [1]=> bool(false) } [4]=> array(2) { [0]=> string(8) "prod_pdf" [1]=> bool(false) } [5]=> array(2) { [0]=> string(10) "prod_image" [1]=> bool(false) } [6]=> array(2) { [0]=> string(12) "prod_altText" [1]=> bool(false) } [7]=> array(2) { [0]=> string(11) "prod_image1" [1]=> bool(false) } [8]=> array(2) { [0]=> string(13) "prod_altText1" [1]=> bool(false) } [9]=> array(2) { [0]=> string(11) "prod_image2" [1]=> bool(false) } [10]=> array(2) { [0]=> string(13) "prod_altText2" [1]=> bool(false) } [11]=> array(2) { [0]=> string(11) "prod_active" [1]=> bool(false) } [12]=> array(2) { [0]=> string(9) "timestamp" [1]=> bool(false) } } ["ParamValues"]=> array(13) { [0]=> string(2) "89" [1]=> string(7) "testing" [2]=> string(16) "Testing Var_dump" [3]=> string(15) "additional info" [4]=> string(27) "Would like a hyperlink here" [5]=> string(34) "would like to select an image here" [6]=> string(13) "alt text test" [7]=> string(16) "additional image" [8]=> string(15) "alt text test 1" [9]=> string(13) "another image" [10]=> string(15) "alt text test 2" [11]=> string(1) "n" [12]=> string(19) "2016-08-02 18:29:05" } ["FilterValues"]=> array(0) { } ["AffectedRows"]=> int(-1) ["InsertID"]=> int(0) ["NumRows"]=> int(0) ["ParamCount"]=> int(13) ["FieldCount"]=> int(0) ["Error"]=> string(62) "Incorrect integer value: 'n' for column 'prod_active' at row 1" ["ErrorNo"]=> int(1366) ["ID"]=> int(3) ["Debug"]=> bool(false) }

I think this means I need to find a LOT more tutorials to watch.

Sign in to reply to this post

Ray BorduinWebAssist

The key is the error at the bottom:

Incorrect integer value: 'n' for column 'prod_active'

So that means you are trying to use 'y' and 'n' for the prod_active field, but it should be set to 0 or 1

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