12-09-2007, 09:33 PM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Sep 2007
Location: Leeds, UK
Posts: 141
Thanks: 6
|
Insert data into two tables with one query
Hey,
Can you insert data into two tables using only one query? I know you can SELECT and UPDATE two tables with one query, which is why I assumed you could do it with INSERT, but upon trying and looking at sites provided by Google, I came up with nothing... which is where I come to ask you lot :P
I tried this:
PHP Code:
//Insert vote into database
mysql_query(sprintf("
INSERT INTO poll_vote, poll SET
poll_vote.poll_id = '%d',
poll_vote.option_id = '%d',
poll_vote.voter_id = '%d',
poll.who_voted = '%s'",
$_POST['poll_id'],
$_POST['poll_choice'],
$_COOKIE['userID'],
$serial_who_voted
)) or die(mysql_error());
But naa.
Any ideas? Cheers!
__________________
Not quite a n00b...
|
|
|
|