Skip to main content
Inspiring
November 19, 2006
Question

INSERT Problem

  • November 19, 2006
  • 12 replies
  • 829 views
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?
This topic is closed to new replies. Start a new post to keep the conversation going.

12 replies

Inspiring
November 22, 2006
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
Inspiring
November 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
Inspiring
November 20, 2006
Help :(
Inspiring
November 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
Inspiring
November 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
Inspiring
November 19, 2006
ok i have added a form validation but still having the same problem
Inspiring
November 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
Inspiring
November 19, 2006