nightfox1405241487 0 Report post Posted June 3, 2006 I've been coding my own forum software and I'm almost finished to release a public preview BUT there's just one problem:My connect.php file! Every script that refrences it gives this error: Parse error: syntax error, unexpected T_VARIABLE in /home/startech/public_html/moonbursttech/beta/forums/source/connect.php on line 23Here's my connect.php file:<?php/*+| Codename: Summer Breeze Alpha 1| ========================================| | (c) 2006 Moonburst Technologies| http://forums.xisto.com/no_longer_exists/| ========================================| License Info: http://forums.xisto.com/no_longer_exists/+| THIS SOFTWARE IS AN INTERNAL COPY AND IS NOT | LICENSED FOR USE. THIS SOFTWARE IS *HIGHLY*| UNSTABLE AND COMES WITH NO WARRANTY. THIS | SOFTWARE IS NOT STABLE!+| FILE: connect.php+*/#Enter your MySQL Database details below:$server = 'localhost' //This is usually "localhost". If you're not sure, leave it as is.$user = 'startech_summer' //This is the USER who has access to the database$sqlpass = 'REMOVED' //This is the PASSWORD for the MySQL user above$db = 'startech_sb1' //This is the DATABASE to store data###DO NOT EDIT BELOW THIS LINE!###$connect = mysql_connect($server, $user, $sqlpass) or die("Could not connect to the database!");mysql_select_db($db, $connect) or die("Could not select database! Does it exist?");?> For some reason, it has a complaint about this line:$user = 'startech_summer' //This is the USER who has access to the databaseI'm not sure what is wrong with it! Can anyone else tell? I even modified the variable from $sqluser to $user but it didn't help.Thanks for any help![N]F Share this post Link to post Share on other sites
vujsa 0 Report post Posted June 4, 2006 $server = 'localhost' //This is usually "localhost". If you're not sure, leave it as is.$user = 'startech_summer' //This is the USER who has access to the database$sqlpass = 'REMOVED' //This is the PASSWORD for the MySQL user above$db = 'startech_sb1' //This is the DATABASE to store data Looks pretty simple to fix.After EVERY statement in php, you MUST end the statement with a semi-colon!Replace the section of code above with this:$server = 'localhost'; //This is usually "localhost". If you're not sure, leave it as is.$user = 'startech_summer'; //This is the USER who has access to the database$sqlpass = 'REMOVED'; //This is the PASSWORD for the MySQL user above$db = 'startech_sb1'; //This is the DATABASE to store data This should solve your problems.If you continue to have difficulties, let me know.Most error code provide a line number. The error is usually in the line just before that. in this case, you didn't use a semi-colon in line 22 to end your statement.Hope this helps. vujsa Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted June 4, 2006 Hi, i agree with the post of vujsa, you forgot to finish your statements with a semicolon, thats your problem, also your connect variable is not strictly necessary, you can decide to use it or not.A suggestion, always include in your database functions the mysql error number and string like this: $connect = mysql_connect($server, $user, $sqlpass) or die("Could not connect to the database!" . mysql_errno() . ": " . mysql_error() );mysql_select_db($db, $connect) or die("Could not select database! Does it exist?" . mysql_errno() . ": " . mysql_error() ); Are very helpful to solve a lots of problems.Best regards, Share this post Link to post Share on other sites
Houdini 0 Report post Posted June 4, 2006 Did you write the code or is it from a ready made package because normally all those semicolons whould have been there and all you would have had to do is enter the proper parameters. The reason the code falieed on the second line is because PHP didnot see where the first assignment was closed; $server = 'localhost'; //This is usually "localhost". If you're not sure, leave it as is.$user = 'startech_summer'; //This is the USER who has access to the database$sqlpass = 'REMOVED'; //This is the PASSWORD for the MySQL user above$db = 'startech_sb1'; //This is the DATABASE to store data Now this is how the code should be and when you enter the proper parameters inside the single quotes then the code should work with no errors provided that you don't have a typo in any of the parameters. Share this post Link to post Share on other sites
nightfox1405241487 0 Report post Posted June 5, 2006 (edited) Did you write the code or is it from a ready made package because normally all those semicolons whould have been there and all you would have had to do is enter the proper parameters. Yeah I wrote it... hence the missing semicolons! Looks like I need to bring back Mr. Post-It with the large giant semicolon drawn on it. Well, actually since I do a lot of programming on my laptop, I'll just use one of the smaller versions and tape it to the top of the screen.I don't know why, but I ALWAYS seem to forget the stupid semicolons. I guess it is the Visual Basic programming getting to me.Thanks for the help of a stupid semicolon!![N]F Edited June 5, 2006 by nightfox (see edit history) Share this post Link to post Share on other sites
vujsa 0 Report post Posted June 5, 2006 Thanks for the help of a stupid semicolon!![N]FGlad we could help. I was a little surprised that you got the same answer three times in a row. Might be nice for people to read the entire topic before replying. Anyway, we all leave a semicolon out here and there everyonce in a while. At least PHP will tell you where the problem is generally. In CSS, the browser just does it's best to parse the data giving an undisirable result and no indication where the problem is.Just remember, the error is alway before the line that was given in the error message. The line number usually refers to the right after the line with the error but occasionally the error will be several lines above depending on your code.Hope this helps vujsa Share this post Link to post Share on other sites
nightfox1405241487 0 Report post Posted June 6, 2006 lol, yeah... well, now there's no reason to forget a semicolon anymore! Now sticking (well taped on) is a post-it (hot pink so it'll get my attention) that says "PHP: SEMICOLON!!"hehe... I'm just that good.[N]F Share this post Link to post Share on other sites