Learn php.net

http://php.net/manual/en/function.mysql-insert-id.php

-- MrEcho

On Sat, Nov 27, 2010 at 1:47 AM, Paul Saenz <[email protected]> wrote:
> I am using an html form/Php script to enter data into a mysql database.
> The script I want to make applies to three tables, but only affects one.
> The html form/Php script enters one row into a table.
>
>
> The two tables to which the mysql_query scripts below apply to both
> have an auto increment primary key.
> The tables are keyword and sop_quote_ref.
> I want to make a script that will automatically insert the primary
> keys of the first two tables into a third table named
> match_keywd_sopqt, which will be a junction table.
> Here is the script I use to create two tables:
> mysql_query("INSERT INTO sop_quote_ref (book,page,input_date)
> VALUE( '$book','$page',NOW())");
> mysql_query("INSERT INTO keyword (keyword) VALUE ($keyword')");
>
> Do I need to assign a mysql_query to a variable? eg:
> $keywd_pri_ky=mysql_query(Select keyword_ID FROM keyword)
>
> How can I make sure that the SELECT will fetch the latest keyword
> entry or in other words the highest increment of the primary key?
> or
> Would I use mysql_fetch_row()?
> Can I tell mysql_fetch_row() to fetch the latest keyword, or highest
> keyword primary key increment?
> Would I assign mysql_fetch_row() to a variable? eg:
> $keyword_pri_ky=mysql_fetch_row()
>
> Thank in advance
> any input/direction would be appreciated.
> Paul
> _______________________________________________
> LinuxUsers mailing list
> [email protected]
> http://socallinux.org/cgi-bin/mailman/listinfo/linuxusers
>
_______________________________________________
LinuxUsers mailing list
[email protected]
http://socallinux.org/cgi-bin/mailman/listinfo/linuxusers

Reply via email to