Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Please Explain Me Mysql, How do i insert information into this config:
vasilevich
post 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
Go to the top of the page
 
+Quote Post
truefusion
post Jun 24 2008, 01:20 PM
Post #2


Ephesians 6:10-17
Group Icon

Group: [MODERATOR]
Posts: 1,893
Joined: 22-June 05
From: The World of Gentoo
Member No.: 8,528
T17 GFX Crew



QUOTE(vasilevich @ Jun 24 2008, 09:14 AM) *
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.
Go to the top of the page
 
+Quote Post
vasilevich
post Jun 24 2008, 01:28 PM
Post #3


Newbie
*

Group: Members
Posts: 4
Joined: 24-June 08
Member No.: 64,100



QUOTE(truefusion @ Jun 24 2008, 01:20 PM) *
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. Attached File  config.php ( 1.19k ) Number of downloads: 1
Go to the top of the page
 
+Quote Post
truefusion
post Jun 24 2008, 01:36 PM
Post #4


Ephesians 6:10-17
Group Icon

Group: [MODERATOR]
Posts: 1,893
Joined: 22-June 05
From: The World of Gentoo
Member No.: 8,528
T17 GFX Crew



QUOTE(vasilevich @ Jun 24 2008, 09:28 AM) *
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.
Go to the top of the page
 
+Quote Post
vasilevich
post Jun 24 2008, 01:43 PM
Post #5


Newbie
*

Group: Members
Posts: 4
Joined: 24-June 08
Member No.: 64,100



QUOTE(truefusion @ Jun 24 2008, 01:36 PM) *
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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Mysql Hostname?(4)
  2. Mysql Phpbb Critical Error?(4)
  3. Mysql Server Problem(3)
  4. Upgrade(0)
  5. Help With Php And Mysql Database(2)
  6. Login And Registration Mysql Problems(2)
  7. Mysql Problems....(4)
  8. Account Creation Ii(5)
  9. Lost Connection To Mysql Server During Query(0)
  10. Php & Mysql Help(2)
  11. Mysql Database Size(6)
  12. Free Mysql Hosting(6)
  13. Mysql Help(1)
  14. Problem With Php(8)
  15. Trap17.com Mysql Databases(2)
  1. Looking For Free Hosting With Mysql, Php And More(4)
  2. Mysql And Free Hosting(8)
  3. Mysql Only(2)
  4. Mysql Help Needed(2)
  5. Which Mysql Version Does Trap17 Offer?(4)
  6. Fantastico Difficulties(1)
  7. I Cannot Connect To Mysql(1)
  8. External Access To Mysql Database(0)
  9. Mysql(5)
  10. Mysql Database Space(3)


 



- Lo-Fi Version Time is now: 7th September 2008 - 12:52 PM