pherrick Posted September 13, 2007 Share Posted September 13, 2007 I am a PHP beginner trying to connect to MySQL data base The following code gives me NO feedback from my browser. <?php $mysqli = new mysqli("localhost", "root", "password", "test"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { printf("Host information: %s\n", mysqli_get_host_info($mysqli)); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/69143-trouble-making-connection-to-mysql/ Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 There is probably a syntax error but you can't see it because you don't have error reporting turned on. add: ini_set('display_errors', 1); error_reporting(E_ALL); to the top. Quote Link to comment https://forums.phpfreaks.com/topic/69143-trouble-making-connection-to-mysql/#findComment-347537 Share on other sites More sharing options...
pherrick Posted September 13, 2007 Author Share Posted September 13, 2007 Thankyou! Now I am getting feed back, another clue to solve. The error trapping routine has told me that line 4 has a syntax error. Fatal error: Class 'mysqli' not found in ........ Thanks for your help. Paul Quote Link to comment https://forums.phpfreaks.com/topic/69143-trouble-making-connection-to-mysql/#findComment-347717 Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 I am not that familiar with the mysqli functions. Does it work when you use the regular mysql functions? Does your PHP have mysql support? Like, if you do phpinfo() does it show the mysqli stuff? Quote Link to comment https://forums.phpfreaks.com/topic/69143-trouble-making-connection-to-mysql/#findComment-347749 Share on other sites More sharing options...
BlueSkyIS Posted September 13, 2007 Share Posted September 13, 2007 Jesirose is right on track as usual. Make sure you have mysqli compiled into your PHP. Quote Link to comment https://forums.phpfreaks.com/topic/69143-trouble-making-connection-to-mysql/#findComment-347761 Share on other sites More sharing options...
pherrick Posted September 14, 2007 Author Share Posted September 14, 2007 I am not able to use any msqli functions. I am able to use msql. As far as my connection problem, I found the info about setting up the msql extensions in the php.ini file. (I found that in FAQ) So I can successfully connect to MYSQL. Thanks I am now getting more dangerous as each day goes by. Thanks to all your help. I will look into compiling the msqli into PHP, so I can use the examples in this book I am using. Thanks again. Paul Quote Link to comment https://forums.phpfreaks.com/topic/69143-trouble-making-connection-to-mysql/#findComment-348395 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.