Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

INSERT Problem

Participant ,
Nov 19, 2006 Nov 19, 2006
Hi,
I am creating a form that inserts a users details into a MySQL dbase. But everytime I type details in this is turned:

Column 'Address' cannot be null

or

Column 'Area' cannot be null

How can I insert information into the form?
TOPICS
Server side applications
827
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2006 Nov 19, 2006
On Sun, 19 Nov 2006 10:33:54 +0000 (UTC), "The_FedEx_Guy"
<webforumsuser@macromedia.com> wrote:

>Hi,
> I am creating a form that inserts a users details into a MySQL dbase. But
>everytime I type details in this is turned:
>
> Column 'Address' cannot be null
>
> or
>
> Column 'Area' cannot be null
>
> How can I insert information into the form?

You'll have to show us the page so we can troubleshoot your code. It
sounds like you're leaving form fields blank where the database
requires that field be not blank. You must validate your form before
the INSERT code.
--
Steve
steve at flyingtigerwebdesign dot com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 19, 2006 Nov 19, 2006
the site can be found here:

http://amsr.no-ip.info/onlinemove/upload.php
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2006 Nov 19, 2006
On Sun, 19 Nov 2006 11:49:46 +0000 (UTC), "The_FedEx_Guy"
<webforumsuser@macromedia.com> wrote:

> http://amsr.no-ip.info/onlinemove/upload.php

Oh dear. Well, for a start you have no validation. You must make sure
that fields that are set to be NOT NULL in your db receive suitable
data from the user. DW has basic javascript form validation (although
you really should use it in conjunction with server-side validation to
be safe).

Also, why does every form element have a hidden field of the same name
and id. That's going to mess things up!
--
Steve
steve at flyingtigerwebdesign dot com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 19, 2006 Nov 19, 2006
Well if I waspassing information as a variable would I not need to give it a hiddenfield to pass the infomation on?

How do I use the validation?

But the text boxes do actually have data in them before I press submit 😞
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2006 Nov 19, 2006
On Sun, 19 Nov 2006 12:42:32 +0000 (UTC), "The_FedEx_Guy"
<webforumsuser@macromedia.com> wrote:

>Well if I waspassing information as a variable would I not need to give it a hiddenfield to pass the infomation on?

The values from your form text fields and list boxes contain the
values for your database. They are in the $_POST array that your form
processor will use in the INSERT statement. get ridof all the hidden
fields that duplicate your visible form fields.

And the validation only checks for an email address - you'd better
check that.
--
Steve
steve at flyingtigerwebdesign dot com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 19, 2006 Nov 19, 2006
I have attached the file for upload.php

I'm still getting this:

Notice: Undefined index: Lrg_Image in C:\sokkit\site\onlinemove\upload.php on line 43

Notice: Undefined index: Image2 in C:\sokkit\site\onlinemove\upload.php on line 44
Column 'Lrg_Image' cannot be null
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 19, 2006 Nov 19, 2006
ok i have added a form validation but still having the same problem
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 19, 2006 Nov 19, 2006
ok since that last post,
I have got rid of the hidden fields, and added the validation, but when I enter information it just reloads the same page with blank boxes.

But the database does not store the information.

I used PHPMaker 3 to create the backend, which allows me to add and delete etc..
http://amsr.no-ip.info/onlinemove/admin/
user: darren
Pass: darren

But it has user information too,
I just need to upload
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 19, 2006 Nov 19, 2006
I am now getting:

Notice: Undefined index: image1 in C:\sokkit\site\onlinemove\upload.php on line 43

Notice: Undefined index: image2 in C:\sokkit\site\onlinemove\upload.php on line 44
Column 'Lrg_Image' cannot be null
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 20, 2006 Nov 20, 2006
Help 😞
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 20, 2006 Nov 20, 2006
On Mon, 20 Nov 2006 22:00:39 +0000 (UTC), "The_FedEx_Guy"
<webforumsuser@macromedia.com> wrote:

>Help :(

Email me your entire php page and I'll take a look.
--
Steve
steve at flyingtigerwebdesign dot com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 22, 2006 Nov 22, 2006
LATEST
On Tue, 21 Nov 2006 07:55:42 +0800, Steve <me@here.com> wrote:

>On Mon, 20 Nov 2006 22:00:39 +0000 (UTC), "The_FedEx_Guy"
><webforumsuser@macromedia.com> wrote:
>
>>Help :(
>
>Email me your entire php page and I'll take a look.


OK, heres what I changed and mailed back to you:

i) The filenames from a file field are stored in the $_FILES array
(not the $_POST array). So those lines in the INSERT statement need
changing to this:

GetSQLValueString($_FILES['Lrg_Image']['name'], "text"),
GetSQLValueString($_FILES['Lrg_Image2']['name'], "text"),

ii) The email address wasn't being added to the form so I added that.
I assume you want to store that.

iii) Your database table has a field called Accepted but it wasn't
getting anything from the form. Since you had it as NOT NULL it was
throwing an error.

iv) I removed the onBlur validation as it popped up when it shouldn't.

v) The file field in your form had a name and id of "Image 2 " but
the database expected $_FILES['Image2']['name'] (no extra space).

I still got the value as NULL in the INSERT statement so I changed the
name to from Image2 to Lrg_Image2 and all was well.

I just tested it and it works now.

Best of luck with it!
--
Steve
steve at flyingtigerwebdesign dot com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines