kraziekris Posted June 20, 2007 Share Posted June 20, 2007 Hi i am trying to connect to a mysql thats installed on my server i made a script called sqltest.php with <html> <head> <title>MySQL Test</title> </head> <body> <h1> <?php $connection=mysql_connect("localhost","root","8119604") or die("Could not connect to MySQL"); echo "Successfully connected to MySQL"; ?> </h1> </body></html> its held at http://beta.mauritiusnews.co.uk/testsql.php if you click you will see the error i get: Fatal error: Call to undefined function mysql_connect() in D:\Inetpub\wwwroot\BETA\testsql.php on line 5 i dont know why my php.ini seems to have the correct extentions???? Thanks Chris Quote Link to comment https://forums.phpfreaks.com/topic/56392-solved-problem-connecting-to-mysql/ Share on other sites More sharing options...
cluce Posted June 20, 2007 Share Posted June 20, 2007 you need to specify #database# and try this using mysqli_connect(); //connects to database $mysqli = mysqli_connect("localhost", "root", "#password#", "#database#"); Quote Link to comment https://forums.phpfreaks.com/topic/56392-solved-problem-connecting-to-mysql/#findComment-278527 Share on other sites More sharing options...
GingerRobot Posted June 20, 2007 Share Posted June 20, 2007 Well it doesn't appear to be getting that far - it looks to me like mysql isn't installed properly. Try running a file with: <?php phpinfo(); ?> in it. Then see if you get a section on mysql. Quote Link to comment https://forums.phpfreaks.com/topic/56392-solved-problem-connecting-to-mysql/#findComment-278537 Share on other sites More sharing options...
thefortrees Posted June 20, 2007 Share Posted June 20, 2007 you shouldn't have to select a db in mysql_connect query. Quote Link to comment https://forums.phpfreaks.com/topic/56392-solved-problem-connecting-to-mysql/#findComment-278538 Share on other sites More sharing options...
cluce Posted June 20, 2007 Share Posted June 20, 2007 thats right my mistake. I tested this code on my computer and it works <?php $connection=mysql_connect("localhost","root","")or die("Could not connect to MySQL"); if (!isset($connection)){ echo ("not connected"); }else{ echo "Successfully connected to MySQL"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/56392-solved-problem-connecting-to-mysql/#findComment-278551 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.