472,103 Members | 1,254 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,103 software developers and data experts.

DB_dataobjects problem with Insert


I am using DB_dataobjects and pear .
I noticed that for some of my tables my insert statement doesnt work correclty ..

Those tableas are tables that i changed recently (i removed the space and added "_" and now i removed the underscore also)

So this is the output
Expand|Select|Wrap|Line Numbers
  1. DataObjects_test: CONNECT: Checking for database database_ in options
  2. DataObjects_test: CONNECT: NEW CONNECTION
  3. DataObjects_test: CONNECT: mysql://__MUNGED__@localhost/testdb 3f7988ed345b6d7c1c02f017c09f70b9
  4. DataObjects_test: CONNECT: __MUNGED__
  5. DataObjects_test: QUERY: INSERT INTO test (Name , Surname , Address , Country ) VALUES ('' , '' , '' , '-1' ) 
  6. DataObjects_test: query: QUERY DONE IN 0.00115609169006 seconds
Notice that in the insert statement you only have Name,Surname,Address,Country...
Expand|Select|Wrap|Line Numbers
  1. $test = new DataObjects_test;
  2. DB_DataObject::debugLevel(5);
  4.     session_start();
  6.     $test->Name=$_REQUEST['name'];
  7.     $test->Surname=$_REQUEST['surname'];
  10.     $test->Address=$_REQUEST['address'];
  11.     $test->Country=$_REQUEST['country'];
  12. $test->Addedby=$_SESSION['user'] ; 
  13.     $test->Date_Added=date("d/m/y");     
But you dont have Date_Added and Addedby .. i think it might be somnething to do with the character encoding in the particular columns but not sure.. i renamed the tables using MySQL GUI Querty manager

and here are the tables in question
Expand|Select|Wrap|Line Numbers
  1. DROP TABLE IF EXISTS `testdb`.`test`;
  2. CREATE TABLE  `testdb`.`test` (
  3.   `Name` varchar(50) default NULL,
  4.   `Surname` varchar(50) character set utf8 default NULL,
  5.   `Address` varchar(50) default NULL,
  6.   `Country` varchar(50) character set utf8 default NULL,
  7.   `City` varchar(50) character set utf8 default NULL,
  8.   `Phone Landline` varchar(50) character set utf8 default NULL,
  9.   `Genre` varchar(50) character set utf8 default NULL,
  10.   `Email` varchar(200) character set utf8 default NULL,
  11.   `Rates` varchar(50) character set utf8 default NULL,
  12.   `Extra Info` varchar(50) character set utf8 default NULL,
  13.   `Web Address` text character set utf8,
  14.   `Proffesion` varchar(50) character set utf8 default NULL,
  15.   `Phone Mobile` varchar(50) character set utf8 default NULL,
  16.   `Address Street` varchar(50) character set utf8 default NULL,
  17.   `Adress Postcode` varchar(50) character set utf8 default NULL,
  18.   `Nickname` varchar(50) character set utf8 default NULL,
  19.   `Description/Other Info` varchar(100) character set utf8 default NULL,
  20.   `Addedby` varchar(50) default NULL,
  21.   `Date_Added` varchar(50) default NULL,
  22.   `Date Contacted` varchar(50) character set utf8 default NULL,
  23.   `Picture` varchar(50) character set utf8 default NULL,
  24.   `Id` int(10) unsigned NOT NULL auto_increment,
  25.   PRIMARY KEY  (`Id`)
Any help will be really appreciated

Aug 4 '08 #1
1 1357

Thanks for the reply

The problem was thet i modified the database but i havent generated the classs for the newly modfied tabels that why the insert didnt work :-)
Aug 6 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Philip Hachey | last post: by
3 posts views Thread by Christian Christmann | last post: by
6 posts views Thread by Mark P | last post: by
4 posts views Thread by Driesen via SQLMonster.com | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.