yshua Posted October 5, 2012 Share Posted October 5, 2012 (edited) Dear Code Talking People: Following code: <?php $mysql = mysql_real_connect('localhost', 'root', '***********', '*******'); if (!$mysql { die('Could not connect: ' . mysql_error()); } ?> gets this emsg: Parse error: syntax error, unexpected ';' in C:\Program Files (x86)\Apache Software Foundation\ Apache2.2\htdocs\includes\db.php on line 4 Probably obvious, but oblivious, Yshua Edited October 5, 2012 by Zane Quote Link to comment https://forums.phpfreaks.com/topic/269135-unable-to-spot-error-in-4-lines/ Share on other sites More sharing options...
Pikachu2000 Posted October 5, 2012 Share Posted October 5, 2012 Missing a closing parenthesis after !$mysql. Quote Link to comment https://forums.phpfreaks.com/topic/269135-unable-to-spot-error-in-4-lines/#findComment-1383062 Share on other sites More sharing options...
Christian F. Posted October 5, 2012 Share Posted October 5, 2012 Also, you should take better care to avoid posting usernames and passwords on the internet. Even if they're just for a local server. Quote Link to comment https://forums.phpfreaks.com/topic/269135-unable-to-spot-error-in-4-lines/#findComment-1383091 Share on other sites More sharing options...
Pikachu2000 Posted October 5, 2012 Share Posted October 5, 2012 And especially so if they were for a live server. Quote Link to comment https://forums.phpfreaks.com/topic/269135-unable-to-spot-error-in-4-lines/#findComment-1383107 Share on other sites More sharing options...
jamesxg1 Posted October 6, 2012 Share Posted October 6, 2012 (edited) As Pikachu2000 said, parenthesis missing... Use the code below. <?php $mysql = mysql_real_connect('localhost', 'root', '***********', '*******'); if (!$mysql) { die('Could not connect: ' . mysql_error()); } ?> Edited October 6, 2012 by jamesxg1 Quote Link to comment https://forums.phpfreaks.com/topic/269135-unable-to-spot-error-in-4-lines/#findComment-1383121 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.