Current location: Hot Scripts Forums » Programming Languages » PHP » php inventory save data problem

php inventory save data problem

Reply
  #1 (permalink)  
Old 07-09-09, 10:23 PM
orange orange is offline
New Member
 
Join Date: Jul 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
php inventory save data problem

hi,

i have a problem with my php inventory system. when I trying to add new data its shows

Quote:
INSERT INTO `site_users` (`user_id`,`user_name`,`user_login`,`user_password `,`user_level`,`user_email`) VALUES('','fendi','fendi','test',0,'fendi@yahoo.co m')Incorrect integer value: '' for column 'user_id' at row 1
I only can add data thru SQL queries. i try to make id as null but still cannot...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-09-09, 10:31 PM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 444
Thanks: 0
Thanked 2 Times in 2 Posts
That's because you're not providing an integer value. If you want to insert NULL, the field definition must allow NULLS.

It appears to me that user_id would be an auto_increment field anyway and should be handled by the database engine. I could be wrong.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 07-09-09, 10:35 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,722
Thanks: 0
Thanked 32 Times in 32 Posts
Quote:
Originally Posted by orange View Post
hi,

i have a problem with my php inventory system. when I trying to add new data its shows
Code:
INSERT INTO `site_users` (`user_id`,`user_name`,`user_login`,`user_password `,`user_level`,`user_email`) VALUES('','fendi','fendi','test',0,'fendi@yahoo.co m')Incorrect integer value: '' for column 'user_id' at row 1
I only can add data thru SQL queries. i try to make id as null but still cannot...
If the user_id is an auto-increment field then leave it out:
Code:
INSERT INTO `site_users` (`user_name`,`user_login`,`user_password `,`user_level`,`user_email`) VALUES('fendi','fendi','test',0,'fendi@yahoo.co m')
But if it is a generic int field then make it 0"
Code:
INSERT INTO `site_users` (`user_id`,`user_name`,`user_login`,`user_password `,`user_level`,`user_email`) VALUES(0,'fendi','fendi','test',0,'fendi@yahoo.co m')
__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wordpress PHP problem... jackster PHP 3 07-06-08 11:51 PM
datetime data type problem... Clark_Kent Database 2 10-07-06 12:16 PM
PHP script problem (please help) osmanmumtaz PHP 0 05-24-05 08:29 AM
Php Form + mysql + display data sent needed TheRaider Script Requests 3 10-07-04 02:30 AM
Syndicating XML data into a website using PHP... Jackal05 PHP 3 07-16-04 03:38 PM


All times are GMT -5. The time now is 02:19 PM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.