i have an HTML form, i also have 3 tables, one for posts, one for tags and one for blog_post_tags.
when the user clicks submit after filling out the form, its sent to a file that is supposed to upload those values to the appropriate fields in the database as well as copy certain values from tags and posts into blog_post_tags. this is what i have:
PHP Code:
mysql_select_db("core", $con);
$sql="INSERT INTO posts (title, post, author_id, date_posted)
VALUES
('$_POST[title]','$_POST[post]','$id','$date')";
$sql="INSERT INTO tags (name)
VALUES
('$_POST[tags]')";
$sql="INSERT INTO blog_post_tags (tag_id) SELECT MAX(id) FROM tags";
$sql="INSERT INTO blog_post_tags (blog_post_id) SELECT MAX(id) FROM posts";
echo "1 record added";
mysql_close($con)
but it doesnt do that, it doesnt do anything as a matter of fact, i tried just using one line in the db connection:
PHP Code:
$sql="INSERT INTO posts (title, post, author_id, date_posted)
VALUES
('$_POST[title]','$_POST[post]','$id','$date')";
and it worked, but if i try this:
PHP Code:
$sql="INSERT INTO posts (title, post, author_id, date_posted)
VALUES
('$_POST[title]','$_POST[post]','$id','$date')";
$sql="INSERT INTO tags (name)
VALUES
('$_POST[tags]')";
it only does the last $sql to tags instead of both
keep in mind that tags is a different table, so is there a way to get it to upload the data from the form into both tables?
please help me out with this