Jump to content
xisto Community
Sign in to follow this  
vasilevich

Please Explain Me Mysql How do i insert information into this config:

Recommended Posts

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

<?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://forums.xisto.com/no_longer_exists/ Thank you for the help!
Edited by vasilevich (see edit history)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 Xisto, 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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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://forums.xisto.com/no_longer_exists/

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.