yshua Posted October 5, 2012 Share Posted October 5, 2012 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 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. 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. 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. 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 As Pikachu2000 said, parenthesis missing... Use the code below. <?php $mysql = mysql_real_connect('localhost', 'root', '***********', '*******'); if (!$mysql) { die('Could not connect: ' . mysql_error()); } ?> 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
Archived
This topic is now archived and is closed to further replies.