phpmysqldatabasenotorm

How do I JOIN one-to-many tables using NotORM lib


i'm using NotOrm lib for working with data in the database. I have to follow the instructions here http://www.sitepoint.com/database-interaction-made-easy-with-notorm/

but did not solve my problem Here is my data structure:

Tables 
   -members 
           ---Indexes 
            PRIMARY id 

   -cards
          ---Indexes 
            PRIMARY id
            INDEX   member_id
          ---Foreign keys
            member_id   members(id) CASCADE CASCADE

I used sql command

ALTER TABLE  `cards` ADD FOREIGN KEY (  `member_id` ) REFERENCES  `xxx`.`members` (`id`)
     ON DELETE CASCADE ON UPDATE CASCADE ;

my code

$cards = $this->db->cards();    
    foreach($cards as $c){
        //echo "here";
        echo $c->members["member_id"];
    }

and response is

=> Message: Undefined index: members_id

Is my data structure correct for using NotORM ? i want to result from SQL as:

select members.f1, members.f2 from members join cards on members.id = cards.member_id where cards.email like '%%' or cards.phone like '%%'

Many thanks!


Solution

  • This question was also asked and answered in the forum.