Re: multiple tables insert
| From: | Barry Rumsey | Date: | Fri, 11 Jan 2002 21:17:05 +0000 |
| Subject: | Re: multiple tables insert | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15675@lists.php.net to get a copy of this message | ||
Thanks for that.
But it has brought up another question. I'll list the tables so you'll know
what i'm on about.
TABLE 1 : Album
alb_id int(11) NOT NULL auto_increment,
art_id int(11) NOT NULL default '0',
alb_name varchar(255) NOT NULL default '',
alb_image varchar(255) NOT NULL default '',
alb_year date NOT NULL default '0000-00-00',
alb_genre varchar(100) NOT NULL default '',
PRIMARY KEY (alb_id)
TABLE 2 : Artist
art_id int(11) NOT NULL auto_increment,
art_name varchar(255) NOT NULL default '',
art_details mediumtext NOT NULL,
PRIMARY KEY (art_id)
TABLE 3 : Songs
song_id int(11) NOT NULL auto_increment,
song_name varchar(255) NOT NULL default '',
song_lyrics mediumtext NOT NULL,
song_info mediumtext NOT NULL,
PRIMARY KEY (song_id)
TABLE 4 : Tracks
track_id int(11) NOT NULL auto_increment,
alb_id int(11) NOT NULL default '0',
art_id int(11) NOT NULL default '0',
song_id int(11) NOT NULL default '0',
PRIMARY KEY (track_id)
Ok I'll be able to work out the simple part of the inserts, but what about
the auto_increment parts thatt relie on the information in the other files.
eg: 'artist.art_id' should be the same as 'album.art_id' the problem is
that 'artist.art_id' is auto_increment and 'album.art_id' is not. So if I
added an artist in the artist table and the auto_increment gave it the value
of 5, how would I update the 'album.art_id' with the same value?
----- Original Message -----
From: "Miles Thompson" <milesthompson@ns.sympatico.ca>
To: "Barry Rumsey" <webmaster@musicsearch.ath.cx>; <php-db@lists.php.net>
Sent: Saturday, January 12, 2002 9:50 AM
Subject: Re: [PHP-DB] multiple tables insert
> Barry
>
> See below ...
>
> At 09:09 AM 1/12/2002 +1300, Barry Rumsey wrote:
> >Two questions:
> >1) If I have a url in the db that points to a image , how do I get php to
> >get this image and display it ?
>
> Check the <IMG> tag in an HTML reference
>
>
> >2) I have 4 tables in the db and would like to know of a good tutorial on
> >inserting to multiple tables form a single form.
>
> There are many tutorials, the one I most frequently recommend is by Julie
> Meloni at http://www.thickbook.com pick the one on custom
> error messages
> as she develops it very nicely.
>
> As for the inserts, in the "processing" part of the script, you'll know
> what I mean when you examine the tutorial, execute an INSERT for the data
> you want to insert in each of the tables. INSERT acts on one table at a
> time, so you'll have four of them.
>
> That should get you going - Miles Thompson
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>