DeanWhitehouse Posted May 12, 2008 Share Posted May 12, 2008 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/105304-solved-insert-into-two-tables-using-different-data/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.