Jump to content

Sven70

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Posts posted by Sven70

  1. Hi,

     

    I am new with PHP and MySql!

     

    I have created a small PHP program which gets values and now I tried to put them with adodb active Records into my

    database!

     

    Here comes a part of my program:

      ...

      include('adodb/adodb.inc.php');

      include('adodb/adodb-active-record.inc.php');

      include 'adodb/adodb-errorpear.inc.php';

      include 'adodb/tohtml.inc.php';

      ...

      $db = ADONewConnection($dbserver);

      ADOdb_Active_Record::SetDatabaseAdapter($db);

      @$db->Connect($host, $user, $password, $database);

      class Vehicle extends ADOdb_Active_Record{}

     

        $vehicle = new Vehicle('t_vehicle');

        $vehicle->manufacturer = $manufacturer;

        $vehicle->model  = $model;

        $vehicle->color  = $color;

        $vehicle->price  = $price;

        $vehicle->save();

     

    When I now run my program, then I got following error message:

    Fatal error: Call to undefined method stdClass::save() in ...

     

    Does anybody has a idea?

    Did I missed something?

     

    Any help would be welcome!

     

    Thanks

    Sven

  2. Thanks a lot.

    This is also solved now for me the error message.

     

    But I get now a error message for the Execute() function:

     

    Fatal error: Call to a member function Execute() on a non-object

     

    As I am new with MySQL, do you also know, what must I change here?

    Or is also something missing?

     

    Thanks!

     

  3. Dear All,

     

    Thanks for your help!

    I tried now serveral things, but all are not running.

    include('../library/adodb5/adodb.inc.php');
    include('../library/adodb5/adodb-active-record.inc.php');
    try {
            $db = NewADOConnection("mysql");
            $db->Connect(localhost, Sven, Sventest, $db);
    //        $db = NewADOConnection("mysql://Sven:Sventest@localhost/ibdata1?persist");
    //        $db = NewADOConnection("mysql://$user:$pwd@$server/$db?persist");
            ADOdb_Active_Record::SetDatabaseAdapter($db);
            $db->Execute("CREATE TABLE 't_vehicle' (
    ...
    

     

    Fatal error: Call to undefined function mysql_connect() in C:\server\library\adodb5\drivers\adodb-mysql.inc.php on line 63
    

     

    Any ideas?

    Why is the adodb function mysql_connect() undefined?

    When PConnect function, comes same error message for mysql_Pconnect()!

    Is something missing in my installation?

    I have installed:

    * PHP version 5.2.6

    * MYSQL Server version 5.0.67-community-nt

     

    Thanks!

  4. Hi, I am new with MySQL!

     

    I have created now a small PHP class to create two tables in my database, but when I run it, I got following error message:

    Call to a member function Execute() on a non-object

     

    Can somebody have a look and explain what I missed or made wrong!

     

    Here come my class:

     

     

    <?php
    error_reporting(E_ALL);
    
    include('adodb5/adodb.inc.php');
    include('adodb5/adodb-active-record.inc.php');
    try {
    $db = NewADOConnection("mysql://$user:$pwd@$server/$db?persist");
    $db->Execute("CREATE TABLE 't_vehicle' (
                    'id' int(20) NOT NULL auto_increment,
    	 		'manufacturer' varchar(50) unsigned NOT NULL auto_increment,
                    'model' varchar(50) NOT NULL default '',
                    'color' varchar(50) NOT NULL default '',
                    'price' varchar(50) NOT NULL default '',
                    PRIMARY KEY  (`id`)
                ) ENGINE=MyISAM;
               ");
    
    $db->Execute("CREATE TABLE 't_vehicleoptions' (
                    'id' int(20) NOT NULL auto_increment,
                    'model' varchar(50) NOT NULL default '',
           	   'airbags' int(1) default NULL,,
                    'aircondition' varchar(3) NOT NULL default 'NO',
                    'radio' varchar(50) NOT NULL default '',
                    'snowtyre' varchar(50) NOT NULL default '',
                    PRIMARY KEY  ('id')
                ) ENGINE=MyISAM;
               ");
    } catch (exception $e) 
    { 		var_dump($e); 		
    	adodb_backtrace($e->gettrace());
    

  5. I upload now also my 4 classes which I short created.

     

    It would be nice if somebody could have a look and adapt what I missed.

    Or explain what I must do!

    Short explanation what I must do:

    I must create two MySQL tables, one for Vehicle, one for VehicleOptions, based on the UML attached earlier.

    Till now I have not done this, because I did not get running MySql. I will try to install and run it again tomorrow.

    What I also must do is, access the database with Active Records from ZendFramework.

    This I figured till now also not out, how to do this.

    When somebody could explain or show how to do, or where I could find detailed descriptions, [/img] would be also nice.

     

    Thanks,

    Sven

     

     

    [attachment deleted by admin]

  6. This is the original UML I got.

     

    My work would be now to add necessary methods to the UML.

    This I have done in Vehicle and in VehicleOptions.

    Then I created the 4 PHP classes, but till now with empty methods, because I am not full sure, what all to do there.

     

    As I sayed, I am now the third day in PHP and do not full know till now.

    What I also should dois, access the database with Zend Framework with Active Records.

     

    Sven

  7. Hope that somebody can help me!

     

    I am new with PHP, 3 days!

    I got a work, which I can at the moment not full solve!

    I got a part of UML for vehicles!

    Now I should first update the UML with a few missing methods (this I have done)!

    Now I should create the PHP classes from this with acces to a SQL database!

    Her I have now the problems.

    I am not sure which functions I really must use and how the access the is.

     

    Is somebody who can help me?

    When yes, I could send the files which I have till now, so that we can discuss!

     

    Thanks,

    Sven

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.