enephs Posted December 4, 2010 Share Posted December 4, 2010 Hi I am beginning the first stages of a tumble log and am having some trouble, this works. <?php $connection = @mysql_connect('localhost','admin','asdf'); if(!$connection) ( die('Could not connect to the server!' .mysql_error()) ) ?> but if I add the following I get an error: <?php $connection = @mysql_connect('localhost','admin','asdf'); if(!$connection) ( die('Could not connect to the server!' .mysql_error()) ) if(!mysql_select_db('tumblelog')) ( die('Could not connect to database') ) ?> This is the error: Parse error: syntax error, unexpected T_IF in E:\AppServ\www\tumblelog\database.php on line 10 I also tried this to solve the problem: <?php $connection = @mysql_connect('localhost','admin','glock123'); if(!$connection) ( die('Could not connect to the server!' .mysql_error()) ) $db = mysql_select_db('tumblelog')) if(!$db) ( die('nope') ) ?> that only gives me this error: Parse error: syntax error, unexpected T_VARIABLE in E:\AppServ\www\tumblelog\database.php on line 9 Quote Link to comment https://forums.phpfreaks.com/topic/220685-help-with-coding/ Share on other sites More sharing options...
laffin Posted December 4, 2010 Share Posted December 4, 2010 yer not using curly braces { } for your blocks of code. parens ( ) usually define an expression Quote Link to comment https://forums.phpfreaks.com/topic/220685-help-with-coding/#findComment-1143041 Share on other sites More sharing options...
enephs Posted December 4, 2010 Author Share Posted December 4, 2010 NVM, I got it, thanks man Quote Link to comment https://forums.phpfreaks.com/topic/220685-help-with-coding/#findComment-1143047 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.