Jump to content

[SOLVED] insert into two tables, using different data


DeanWhitehouse

Recommended Posts

this is my code, i need to insert two textarea's into two different tables, but with one submit button, this is so i can insert two different languages into my database for news. But i am getting mysql syntax errors

 

<?php
require_once 'nav_bar.php';
$time_stamp = date("d.m.Y");
$date = $time_stamp;
if ($_SESSION['dark_flame'] == true)
{
if(isset($_POST['submit']))
{
$newname = mysql_real_escape_string($_POST['newname']);
$newcontent = mysql_real_escape_string($_POST['newcontent']);
$runame = mysql_real_escape_string($_POST['ru_name']);
$rucont = mysql_real_escape_string($_POST['ru_content']);
if ($newname && $newcontent )
{
mysql_query("INSERT INTO `darkflame_news` AND `darkflame_news_ru` (id,  name, content, time) VALUES( '','$newname','$newcontent', '$date') AND (id,  name, content, time) VALUES( '','$runame','$rucontent', '$date')")
or die('Error ' . mysql_error());
echo "News Saved";
}
else
{
echo "Please Fill In All The Fields";
}
}
?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">News Name: <input type="text" name="newname" /><br />News Content:<textarea name="newcontent" cols="30" rows="10" title="Edit Site Content"></textarea><br />
RU News Name: <input type="text" name="ru_name" /><br />RU News Content:<textarea name="ru_content" cols="30" rows="10" title="Edit Site Content"></textarea>
<br />
<input type="submit" value="Submit" name="submit" />
</form>
<?php
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.