p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP How-To (http://p2p.wrox.com/forumdisplay.php?f=98)
-   -   How do I insert data into multiple table ? (http://p2p.wrox.com/showthread.php?t=37947)

bmalex1 February 2nd, 2006 02:43 PM

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


All times are GMT -4. The time now is 06:16 PM.

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