Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 2nd, 2006, 02:43 PM
Registered User
 
Join Date: Feb 2006
Location: Dallas, Texas, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to bmalex1
Default How do I insert data into multiple table ?



Greetings to all,

I am new to this forum and fairly new to php/mysql.
I have been trying to learn how to insert data into multiple tables in mysql database. Here is a sample of the script that I use.........

<?php

@$link = mysql_connect(SYSTEM,USERNAME,PASSWORD);
if(!$link)
{
echo "Database seems to be down";
exit;
}

mysql_select_db(DATABASE) or die( "Unable to select database");

$query = "INSERT INTO 'table1','table2','table3' WHERE field1= ".$_POST['field1']." AND field2= ".$_POST['field2']." ";

$result = @mysql_query($query);
if(!$result)
{
echo "Error - Could not insert your data into the database.";
  echo mysql_error().'<br>';
}

mysql_close();

echo"
<html>

My problem is that mysql_error(). tells me there is an error in my syntax on line 1 which would be $query = ............

Can someone tell me what is wrong with my script and how to correct it?

Barry Alexander
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
INSERT multiple rows to a table nvillare Oracle 7 November 3rd, 2007 04:47 AM
insert value into multiple table AzlanAziz SQL Language 5 January 12th, 2007 06:01 AM
insert multiple records into a table from values Deepak Chauhan Oracle 3 May 12th, 2006 10:35 PM
Insert multiple records in a Inner Join Table rylemer Access 1 August 22nd, 2004 07:44 AM
Insert multiple records in a Inner Join Table rylemer Access VBA 0 July 19th, 2004 03:54 PM



All times are GMT -4. The time now is 12:22 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.