php-db | 2001041
Date: 04/15/01
- Next message: Andrew Hill: "Re: [PHP-DB] mssql - unable to read large text fields"
- Previous message: Andrew Hill: "Re: [PHP-DB] odbc and oracle"
- In reply to: Randall Barber: "[PHP-DB] 2-Table query"
- Next in thread: Andrew Hill: "Re: [PHP-DB] 2-Table query"
- Reply: Andrew Hill: "Re: [PHP-DB] 2-Table query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Randall,
Try making $qryStr contain something like "insert into table1 (col1, col2)
values ($val1, $val2) /; insert into table2 (col1, col2) values ($val1,
$val2);
Not sure if the slash is the proper escape - it should work.
Best regards,
Andrew
--------------------------------------------
Andrew Hill . Director Technology Evangelism
OpenLink Software . www.openlinksw.com
Internet Data Integration Technology
On 4/9/01 8:31 PM, "Randall Barber" <rdb55 <email protected>> wrote:
> I would like to update two tables at the same time.
>
> Currently I update each one separately, like so,
>
> $qryStr = "INSERT INTO table1 etc....";
> odbc_exec($dbConn, $qryStr);
>
> $qryStr = "INSERT INTO table2 etc....";
> odbc_exec($dbConn, $qryStr);
>
> Now, the problem there is if the first one passes, but the second fails, if
> the user tries to re-submit, the first now fails because of a primary key
> clash which is right, but then never executes the second one.
>
> This is what I THINK I should do,
>
> $qryStr = "(INSERT INTO table1 ( col1, col2 ) VALUES ( '$val1', '$val2' ) )
> AND (INSERT INTO table2 ( col1, col2 ) VALUES ( '$val1', '$val2' ) )";
> odbc_exec($dbConn, $qryStr);
>
> Any ideas are appreciated... I am not experienced with SQL query precedences,
> or operators, etc... A good reference for that very thing would be nice.
> Thanks in advance,
> RDB
>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andrew Hill: "Re: [PHP-DB] mssql - unable to read large text fields"
- Previous message: Andrew Hill: "Re: [PHP-DB] odbc and oracle"
- In reply to: Randall Barber: "[PHP-DB] 2-Table query"
- Next in thread: Andrew Hill: "Re: [PHP-DB] 2-Table query"
- Reply: Andrew Hill: "Re: [PHP-DB] 2-Table query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

