William William - 10 months ago 64
PHP Question

Mysql query insert

I am trying to run this insert on a post page but it only inserts one table query which is discussion_topics table not both.

$sql = "INSERT INTO `discussion_topics`(`topic_title`,`topic_poster`,`topic_time`,`discussion_id`)";
$sql .= "VALUES('{$topic_title}','{$user_id}','{$discussion_time}','{$discussions}')";

$result = query ($sql);

$sql2 = "INSERT INTO `discussion_posts`(`discussion_id`,`poster_id`,`post_text`,`post_time`)";
$sql2 .= "VALUES('{$discussions}','{$user_id}','{$post_text}','{$discussion_time}')";
$result = query ($sql2);


after your query it should have this after both.

$result = query($sql);