[Solved]having a parse error on a function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shab620
Forum Commoner
Posts: 48
Joined: Tue Jan 18, 2005 7:50 pm

[Solved]having a parse error on a function

Post 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??
Last edited by shab620 on Wed Mar 30, 2005 7:05 pm, edited 1 time in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

in your code you have

$topic_id=mysql_insert_id():
shab620
Forum Commoner
Posts: 48
Joined: Tue Jan 18, 2005 7:50 pm

Post by shab620 »

Hello Phenom

Thanks for that

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

:D :D
Post Reply