|
|
|
|
![]() ![]() |
Jun 24 2008, 01:14 PM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 4 Joined: 24-June 08 Member No.: 64,100 |
Hi, I wanted to try just to test how can i connect my website to another mysql server, but i have no idea how to insert the other mysql information such as port and host etc.... so here is the config file please give me an example
CODE <?php // mySQL information $server = 'FRESHSQL.COM:3306'; // MySql server $username = 'vasilevich'; // MySql Username $password = '*******'; // MySql Password $database = 'vasilevich'; // MySql Database // The following should not be edited $con = mysql_connect("$server","$username","$password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("$database", $con); //mysql_query("UPDATE ava_games SET height='300' WHERE height='0'") or die (mysql_error()); // $sql = mysql_query("SELECT * FROM ava_settings"); $row = mysql_fetch_array($sql); $site_name = $row['site_name']; $site_url = $row['site_url']; $seo_on = $row['seo_on']; $template_url = $row['template_url']; $max_results = $row['max_results']; $image_height = $row['image_height']; $image_width = $row['image_width']; $adsense = $row['adsense']; $cat_numbers = $row['cat_numbers']; $email_on = $row['email_on']; $add_to_site = $row['add_to_site']; $plays = $row['plays']; $new_plays = 4; // // Convert super globals if (phpversion() >= '5.0.0') { $HTTP_POST_VARS = ($_POST); $HTTP_GET_VARS = ($_GET); } ?>($_GET); } ?> here is the information i would like to insert: Database:vasilevich username: vasilevich host:FRESHSQL.COM PORT:3306 password is annymouse but i would still like you to include this password as an example: ******* The mysql server is at this site:http://bluesql.net Thank you for the help! This post has been edited by vasilevich: Jun 24 2008, 01:17 PM |
|
|
|
Jun 24 2008, 01:20 PM
Post
#2
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,893 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
here is the information i would like to insert: Database:vasilevich username: vasilevich host:FRESHSQL.COM PORT:3306 You don't (normally) insert that information into the database: it remains in the PHP document. It doesn't need to be in the database in order to connect to the database. And try not to give away your passwords. |
|
|
|
Jun 24 2008, 01:28 PM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 4 Joined: 24-June 08 Member No.: 64,100 |
You don't (normally) insert that information into the database: it remains in the PHP document. It doesn't need to be in the database in order to connect to the database. And try not to give away your passwords. as you see i changed my password with "******" in that way i didn't gave any of my passwords, i just need a good example on how to insert the mysql information into the config.php file of my website thank you.here is the config.php file if you would like to see what i mean. i don't mind of the password as its the password of a mysql server not from trap17, i don't mind it is just for testing purpose i need example of how to insert a mysql information into config.php from a distant hosting sql.
config.php ( 1.19k )
Number of downloads: 1 |
|
|
|
Jun 24 2008, 01:36 PM
Post
#4
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,893 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
i just need a good example on how to insert the mysql information into the config.php file of my website thank you. That's different from what i understood in your previous post. But in order to edit a file in PHP, you need to use fopen, fwrite and fclose (PHP4) or file_put_contents (PHP5). You must also make sure the file is editable by chmodding it either 666 or 777. After editing the file, make sure to chmod it back to 644. |
|
|
|
Jun 24 2008, 01:43 PM
Post
#5
|
|
|
Newbie ![]() Group: Members Posts: 4 Joined: 24-June 08 Member No.: 64,100 |
That's different from what i understood in your previous post. But in order to edit a file in PHP, you need to use fopen, fwrite and fclose (PHP4) or file_put_contents (PHP5). You must also make sure the file is editable by chmodding it either 666 or 777. After editing the file, make sure to chmod it back to 644. i am very sorry for that many questions but look what i mean, for example, at a web hosting that provide free mysql serviece along their web host they offer those informations: host: sql.examle.com username:myusername database: databaseofmychouice password:passwordofmychoice that was the information that i acctualy inserted in the config.php file to make it work, but when i want to try another sql server, not on the same host as the example i gave http://bluesql.net when i register on a distant sql server that has no web hosting, they also offer for example, host=sql.example.com port=xxxx i don't understand what to do with the port, as usually the mysql hosters on my web host do not need port information to connect to them. Thank you for your help. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 7th September 2008 - 12:52 PM |