DB_dataobjects problem with Insert

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • panos100m
    New Member
    • Aug 2007
    • 23

    DB_dataobjects problem with Insert

    Hi

    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
    Code:
    DataObjects_test: CONNECT: Checking for database database_ in options
    DataObjects_test: CONNECT: NEW CONNECTION
    DataObjects_test: CONNECT: mysql://root:pvcllc@localhost/testdb 3f7988ed345b6d7c1c02f017c09f70b9
    DataObjects_test: CONNECT: a:1:{s:32:"3f7988ed345b6d7c1c02f017c09f70b9";O:8:"DB_mysql":8:{s:10:"autocommit";b:1;s:8:"dbsyntax";s:5:"mysql";s:3:"dsn";a:9:{s:7:"phptype";s:5:"mysql";s:8:"dbsyntax";s:5:"mysql";s:8:"username";s:4:"root";s:8:"password";s:6:"pvcllc";s:8:"protocol";s:3:"tcp";s:8:"hostspec";s:9:"localhost";s:4:"port";b:0;s:6:"socket";b:0;s:8:"database";s:8:"testdb";}s:8:"features";a:7:{s:5:"limit";s:5:"alter";s:8:"new_link";s:5:"4.2.0";s:7:"numrows";b:1;s:8:"pconnect";b:1;s:7:"prepare";b:0;s:3:"ssl";b:0;s:12:"transactions";b:1;}s:9:"fetchmode";i:1;s:22:"fetchmode_object_class";s:8:"stdClass";s:7:"options";a:8:{s:16:"result_buffering";i:500;s:10:"persistent";b:0;s:3:"ssl";b:0;s:5:"debug";i:0;s:14:"seqname_format";s:6:"%s_seq";s:8:"autofree";b:0;s:11:"portability";i:0;s:8:"optimize";s:11:"performance";}s:13:"was_connected";b:1;}}
    DataObjects_test: QUERY: INSERT INTO test (Name , Surname , Address , Country ) VALUES ('' , '' , '' , '-1' ) 
    DataObjects_test: query: QUERY DONE IN 0.00115609169006 seconds
    Notice that in the insert statement you only have Name,Surname,Ad dress,Country.. .
    [code=php]
    $test = new DataObjects_tes t;
    DB_DataObject:: debugLevel(5);

    session_start() ;

    $test->Name=$_REQUE ST['name'];
    $test->Surname=$_REQU EST['surname'];


    $test->Address=$_REQU EST['address'];
    $test->Country=$_REQU EST['country'];
    $test->Addedby=$_SESS ION['user'] ;
    $test->Date_Added=dat e("d/m/y");
    [/code]
    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
    [code=mysql]
    DROP TABLE IF EXISTS `testdb`.`test` ;
    CREATE TABLE `testdb`.`test` (
    `Name` varchar(50) default NULL,
    `Surname` varchar(50) character set utf8 default NULL,
    `Address` varchar(50) default NULL,
    `Country` varchar(50) character set utf8 default NULL,
    `City` varchar(50) character set utf8 default NULL,
    `Phone Landline` varchar(50) character set utf8 default NULL,
    `Genre` varchar(50) character set utf8 default NULL,
    `Email` varchar(200) character set utf8 default NULL,
    `Rates` varchar(50) character set utf8 default NULL,
    `Extra Info` varchar(50) character set utf8 default NULL,
    `Web Address` text character set utf8,
    `Proffesion` varchar(50) character set utf8 default NULL,
    `Phone Mobile` varchar(50) character set utf8 default NULL,
    `Address Street` varchar(50) character set utf8 default NULL,
    `Adress Postcode` varchar(50) character set utf8 default NULL,
    `Nickname` varchar(50) character set utf8 default NULL,
    `Description/Other Info` varchar(100) character set utf8 default NULL,
    `Addedby` varchar(50) default NULL,
    `Date_Added` varchar(50) default NULL,
    `Date Contacted` varchar(50) character set utf8 default NULL,
    `Picture` varchar(50) character set utf8 default NULL,
    `Id` int(10) unsigned NOT NULL auto_increment,
    PRIMARY KEY (`Id`)
    ) ENGINE=MyISAM AUTO_INCREMENT= 1190 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNA MIC;
    [/code]
    Any help will be really appreciated

    Thanks
    Last edited by Atli; Aug 6 '08, 03:27 AM. Reason: Added [code] tags
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    This is not very helpful
    I noticed that for some of my tables my insert statement doesnt work correclty
    I can't see an INSERT query.
    Nevertheless this output
    Code:
    INSERT INTO test (Name , Surname , Address , Country ) VALUES ('' , '' , '' , '-1' )
    Seems to indicate that your REQUEST array is empty

    Comment

    • panos100m
      New Member
      • Aug 2007
      • 23

      #3
      Hi

      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 :-)

      Comment

      Working...