Page 1 of 1

[Solved]having a parse error on a function

Posted: Wed Mar 30, 2005 6:46 pm
by shab620
Hye
I'm trying a new script which should build a mini forum

I'm having a parse error on a line which should return the id of the last record inserted. Instead it has a parse error. The code is "$topic_id=mysql_insert_id():" which it has an error on.

Can anyone give me a hand????

The script

Code: Select all

$add_topic = ("insert into forum_topics values ('','$topic_title',now(),'$topic_owner')");
mysql_query($add_topic,$connect) or die(mysql_error());
$topic_id=mysql_insert_id():
$add_post= ("INSERT INTO forum_posts values ('','$topic_id','$post_text',now(),'$topic_owner')");
mysql_query($add_post,$connect) or die(mysql_error());
$msg = "<p>The <strong>$topic_title</strong> topic has been created.</p>";
?>
Hope sombody can help??

Posted: Wed Mar 30, 2005 7:01 pm
by John Cartwright
in your code you have

$topic_id=mysql_insert_id():

Posted: Wed Mar 30, 2005 7:05 pm
by shab620
Hello Phenom

Thanks for that

it works perfectly now, can't belive i made such a basic mistake, lol

:D :D