EchoFool Posted April 24, 2008 Share Posted April 24, 2008 I have a syntax error when creating a string to my variable, but I don't know how to fix it. Could you help me please! My error is: Parse error: syntax error, unexpected '[', expecting ')' in C:\xampp\htdocs\register.php on line 137 It's relating to this linke $message = $message. "localhost/activate.php?x=" .mysql_insert_id(['UserID]). "&y=$EmailCode"; in the script below: <?php $query = "INSERT INTO `tableusers` (Username,Password,Email,CountryID,IP,Gender,RegisterDate,JobTitle,ActivateCode) Values ('$Username', '$Password', '$Email', '$Country', '$ip', '$Gender', '$Date', 'Unemployed','$EmailCode')"; mysql_query($query) or die(mysql_error()); unset($_SESSION['security_code']); if (mysql_affected_rows() == 1) { // Send the email. $subject = "Welcome"; $headers = 'From: Admin'; $message = "Thank you for registering.. To activate your account, please click on this link:\n\n"; $message = $message. "localhost/activate.php?x=" .mysql_insert_id(['UserID']). "&y=$EmailCode"; mail($Email, $subject, $message, $headers); ?> Hope you can help me out. Link to comment https://forums.phpfreaks.com/topic/102741-syntax-error-please-help/ Share on other sites More sharing options...
DarkWater Posted April 24, 2008 Share Posted April 24, 2008 Just use mysql_insert_id() with no parameters. Link to comment https://forums.phpfreaks.com/topic/102741-syntax-error-please-help/#findComment-526197 Share on other sites More sharing options...
EchoFool Posted April 24, 2008 Author Share Posted April 24, 2008 Argh, thankyou Link to comment https://forums.phpfreaks.com/topic/102741-syntax-error-please-help/#findComment-526202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.