GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Easy PHP question - how to NOT use localhost (https://gfy.com/showthread.php?t=433740)

Steen2 02-18-2005 10:44 PM

Easy PHP question - how to NOT use localhost
 
What do I put in the place of "localhost" if I want to use a database on a seperate server.

The server's IP? The server's DNS?

Thank you.

Steen2 02-18-2005 10:52 PM

bump for an answer

labeledas 02-18-2005 10:59 PM

i usally just put the address http://somehost.server.com i guess ip would work
, but i am pretty sure you have to have permissions on the database setup to allow outside connections

broke 02-18-2005 11:07 PM

You use the database hostname or the database host IP.

Steen2 02-18-2005 11:15 PM

Does this look right? Because it's not working...

PHP Code:

function mysqlconn() {
 
$user "f***ay_f**";
 
$pass "***";
 
$db "f***y_f****s@64.**.120.**";
 
$newconnect mysql_pconnect(64.**.120.**, $user,$pass);
 
mysql_select_db($db); 

Please note, aterisks just mean that I don't want to divulge any info.

The above gives me a parse error, changing
$newconnect = mysql_pconnect(64.**.120.**, $user,$pass);
to
$newconnect = mysql_pconnect(localhost, $user,$pass);
gives me "Incorrect database name..." but the page still shows.

labeledas 02-18-2005 11:20 PM

put the ip in quotes

Steen2 02-18-2005 11:44 PM

Quote:

Originally Posted by labeledas
put the ip in quotes

Quote:

Incorrect database name 'f***y_f*******s@64.**.120.**'
:helpme Thx.

labeledas 02-18-2005 11:48 PM

so that worked or you still having trouble

Steen2 02-18-2005 11:54 PM

Quote:

Originally Posted by labeledas
so that worked or you still having trouble

Putting quotes on the
$newconnect = mysql_pconnect("64.**.120.**", $user,$pass);

part gives me the error:

Incorrect database name 'f***y_f*******s@64.**.120.**'

labeledas 02-18-2005 11:56 PM

cut @64.**.120.** from the dbname

Adultnet 02-19-2005 12:01 AM

In the connection code you can just replace localhost to ip adress but the database you are connecting to should allow remote connections to it. It shold be configed in the mysql side.

Steen2 02-19-2005 12:12 AM

Quote:

Originally Posted by Adultnet
In the connection code you can just replace localhost to ip adress but the database you are connecting to should allow remote connections to it. It shold be configed in the mysql side.

Ok, where do I go within PHPmyAdmin to set that up? Allow for remote connections.

Thank you very much.

Steen2 02-19-2005 12:17 AM

Do I go into cPanel and under "access hosts" add the IP address of the site that will be accessing?

Steen2 02-19-2005 12:40 AM

Now I am getting

Access denied for user: '@localhost' to database 'f***y_f***s'



How do I allow permission?

I added the IP and domain to access host where the DB resides.


All times are GMT -7. The time now is 03:32 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123