prakash911 Posted March 15, 2010 Share Posted March 15, 2010 the error message i get is: Warning: mysql_connect(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-4.0/DST' instead in C:\Users\Kash\Documents\My Web Sites\LU Books\db_connect.php on line 8 Warning: mysql_connect(): Connecting to 3.22, 3.23 & 4.0 is not supported. Server is 4.0.16-nt in C:\Users\Kash\Documents\My Web Sites\LU Books\db_connect.php on line 8 Warning: mysql_connect(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-4.0/DST' instead in C:\Users\Kash\Documents\My Web Sites\LU Books\db_connect.php on line 8 Warning: mysql_connect(): Connecting to 3.22, 3.23 & 4.0 servers is not supported in C:\Users\Kash\Documents\My Web Sites\LU Books\db_connect.php on line 8 the line the error is coming from or rather i posted the whole file: <?php function db_connect() { $host_name = "localhost:3306"; $user_name = "root"; $password = "chennupati"; $db_name = "bookstore"; $db_link = mysql_connect($host_name, $user_name, $password) or die("<html><script language='JavaScript'>alert('Unable to connect to database! Please try again later.'),history.go(-1)</script></html>"); mysql_select_db($db_name) or die("Could not select database $db_name"); return $db_link; } ?> and in my script i am using this call to access the function: $db_link = db_connect(); can someone please tell what this error means and how i can fix this. Quote Link to comment https://forums.phpfreaks.com/topic/195345-php-connecting-to-mysql-error-help/ Share on other sites More sharing options...
Rifts Posted March 15, 2010 Share Posted March 15, 2010 try something a little more simple like this <?php mysql_connect("localhost", "yourlogin", "yourpass") or die(mysql_error()); echo "Connected to MySQL<br />"; ?> let me know if that alone works Quote Link to comment https://forums.phpfreaks.com/topic/195345-php-connecting-to-mysql-error-help/#findComment-1026519 Share on other sites More sharing options...
PFMaBiSmAd Posted March 15, 2010 Share Posted March 15, 2010 A) Read the errors messages. B) You have not set a default time zone setting for php to use. C) The version of mysql is too old and is not supported by the client library that php is using to connect to the database. Quote Link to comment https://forums.phpfreaks.com/topic/195345-php-connecting-to-mysql-error-help/#findComment-1026521 Share on other sites More sharing options...
prakash911 Posted March 15, 2010 Author Share Posted March 15, 2010 nope i am still getting the same error. Quote Link to comment https://forums.phpfreaks.com/topic/195345-php-connecting-to-mysql-error-help/#findComment-1026522 Share on other sites More sharing options...
prakash911 Posted March 15, 2010 Author Share Posted March 15, 2010 i installed mysql version mysql-4.0.16-win.zip on my pc, guys some other news that might help figure out the problem. i am using microsoft web expression 3, do i have to manually do something with web expression program for it to connect to mysql server or is this the right way. Quote Link to comment https://forums.phpfreaks.com/topic/195345-php-connecting-to-mysql-error-help/#findComment-1026524 Share on other sites More sharing options...
Rifts Posted March 15, 2010 Share Posted March 15, 2010 just go here and install and use this www.wampserver.com/en/ your life will be all fixed Quote Link to comment https://forums.phpfreaks.com/topic/195345-php-connecting-to-mysql-error-help/#findComment-1026534 Share on other sites More sharing options...
prakash911 Posted March 15, 2010 Author Share Posted March 15, 2010 i used to use wamp server before but it gave me too many problems and i did try it with wamp and it still wont connect. Quote Link to comment https://forums.phpfreaks.com/topic/195345-php-connecting-to-mysql-error-help/#findComment-1026548 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.