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
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.