Re: Re: Film Database
| From: | Tim | Date: | Thu, 13 Jul 2000 21:28:20 +0000 |
| Subject: | Re: Re: Film Database | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1137@lists.php.net to get a copy of this message | ||
I think I'm getting there...
... but I'm having problems with this: when I query the film_details table
to get the film_id, I get a single value. That bit works okay, but when I
try to assign that value to a variable, I get an error message.
The command I'm using is:
$row = pg_fetch_row ($resultSet, 0);
$film_id_retrieved = $row[0];
where $resultSet is the array returned by my query. I know the query is
working, because I've printed it to the screen in between the query and the
above step, just to check.
Also, I ready somewhere that I could use the pg_getlastoid function to
retrieve the object identifier of the last record inserted. But... what
exactly is an object identifier?
John Parker <jparker@omniquip.textron.com> wrote in message
news:396CBDC0.68AD069B@omniquip.textron.com...
> Hmmmm............
> The most obvious way would be to insert the film_details and
> cast_details table then query them back to get the video_id and film_id
> info (using a select query, actually two select queries). But I can't
> help think that there's a better way. List- Any options??
>
> John Parker
>
>
> Tim Jones wrote:
> >
> > Oh - I just thought of another question - I hope you don't mind...
> >
> > I am using the SERIAL data type in my PostgreSQL database to increment
the
> > video id and film id counters for each new record - this will be okay
for
> > adding to the film_details and cast_details tables, but how do I add the
> > correct info to the video_details table?
> >
> > Tim
> >
> > ----- Original Message -----
> > From: John Parker <jparker@omniquip.textron.com>
> > To: <tj198@soton.ac.uk>; <php-db@lists.php.net>
> > Sent: Wednesday, July 12, 2000 2:23 PM
> > Subject: Re: Film Database
> >
> > > Sure no problem. Make a form to get all the relevant info and pass it
> > > to a php page.
> > > In the PHP code create the relevant Insert queries of the form:
> > >
> > > $query1 = sprintf("INSERT INTO video_details (video_id,film_id,format)
> > > VALUES (%s,%s,%s)",$video_id,$film_id,$format);
> > > $query2 = sprintf("INSERT INTO film_details (film_id,title,director)
> > > VALUES (%s,%s,%s)",$film_id,$title,$director);
> > > $query3 = .... you get the idea.
> > >
> > > then execute the queries in your preferred manner (depending on the
> > > database you're using, e.g.
> > > mysql_query($query1);
> > > mysql_query($query2);
> > > ....
> > >
> > > There is no problem running multiple queries to different tables in
the
> > > same script.
> > >
> > > Hope this helps.
> > >
> > > Sincerley,
> > >
> > > John Parker
> > >
> > > > Hi, I am wanting to set up a small database, initially with a list
of
> > the
> > > > video cassettes and dvds that I own.
> > > >
> > > > I want to have three tables - one with the video details (video id,
film
> > id,
> > > > and format - dvd or vhs), one with film details (film id, film
title,
> > > > director), and one with the cast details (film id, cast).
> > > >
> > > > I can set these tables up okay, but how do I go about writing a form
in
> > PHP
> > > > to allow me to add to the database? I want to write one form that
allows
> > me
> > > > to add information to all three tables at one time. Is this
possible?
> > > >
> > > > Any help would be much appreciated.
> > > >
> > >
> > > --
> > > John Parker, Design Engineer, Snorkel International
> > > Ph: 816/676-6419 Fax: 785/989-3556
> > >
>
> --
> John Parker, Design Engineer, Snorkel International
> Ph: 816/676-6419 Fax: 785/989-3556
>
> --
> 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
>