Mihaela
dbInstall.php must have a "set storage_engine = InnoDB" query applied to the database after the database has been created. Otherwise, the foreign key constraints wont't work. See dbInstall.php in cis605-donate project in Google Code (I made a commit a few minutes ago).
Each time we run dbInstallSandbox.php, we must run dbInstall.php first.
Be very careful with foreign keys. Their values must exist in the parent table.
mysql_insert_id( ) works only for auto_increment keys. If a key is a both a primary key AND a foreign key, then mysql_insert_id( ) does not work. This is because such key does not have auto_increment in its definition.
Finally, I added functions in dbIndividual.php (donate project) and Individual to be called in dbInstallSandbox.php and produce an output of what exactly was inserted in the database. This is a model that can be used for any other table. Note that Individual table does not have an auto_increment primary key. In the case of the tables with an auto_increment primary key, mysql_insert_id( ) must be used instead of hard coded numerical values.
> -----Original Message-----
> From: cis...@googlegroups.com [mailto:cis...@googlegroups.com] On
> -----Original Message-----
> From: cis...@googlegroups.com [mailto:cis...@googlegroups.com] On
> Behalf Of Scott
> Sent: Monday, May 02, 2011 8:47 PM
> To: cis605