Results 1 to 3 of 3
Thread: INSERT INTO broken.
Apr 5, 2011, 17:19 #1
INSERT INTO broken.
Well since this is about INSERT I considered opening another thread for this one.
I have arrange an INSERT query as below. It is inserting ok except that the price field is being inserted in the lasname and lastname is not being inserted at all. Now I have checked the INSERT and the form I am sure there is not mistypes. So what is left is the table structure for the fields which I think where the problem is.
"INSERT INTO costumers
-- -- Table structure for table `costumers` -- CREATE TABLE IF NOT EXISTS `costumers` ( `id` int(11) NOT NULL AUTO_INCREMENT, `firstname` char(50) CHARACTER SET utf8 NOT NULL, `lastname` char(50) CHARACTER SET utf8 NOT NULL, `birthdate` date NOT NULL, `telephone` varchar(12) CHARACTER SET utf8 NOT NULL, `product_name` varchar(225) CHARACTER SET utf8 NOT NULL, `price` varchar(12) CHARACTER SET utf8 NOT NULL, `details` varchar(225) CHARACTER SET utf8 NOT NULL, `category` varchar(100) CHARACTER SET utf8 NOT NULL, `subcategory` varchar(100) CHARACTER SET utf8 NOT NULL, `City` varchar(50) CHARACTER SET utf8 NOT NULL, `state` varchar(50) CHARACTER SET ucs2 NOT NULL, `zipcode` varchar(10) CHARACTER SET utf8 NOT NULL, `Country` char(25) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
Apr 5, 2011, 18:39 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 59 Post(s)
- 3 Thread(s)
your INSERT query is just fine
you can confirm this by substituting actual values for your php variables, and running the query right in mysql, i.e. not via php
this means you should check to make sure you are assigning the php variable values properly
that's probably where your problem is
Apr 6, 2011, 06:20 #3
There was some mistakes in the form, I was giving a different name in some of the form fields, that's why there was not data recognized by the query statement.