Division by zero?

kiko_friendly

New Member
Oh, I fixed it. I'm stuck again, though.

Just wondering how to host a MYSQL database, but use it on another site?

change this to your Database Password
$affdb_name = "*****";


That's what it'd be if it were on the actual site (in some weird code, IDK what it is), but IDK what to put if I am hosting from the site, and using it on another...

I know the IP...

Access Hosts:
***.168.1.%
localhost

Host (% wildcard is allowed):


I put *'s in...but WTH? Sorry, n00b to PHP or whatever the hell I'm working with, here.
 
Last edited by a moderator:

zkiller

Super Moderator
Staff member
assuming that the host of the mysql database allows remote connections from off site servers, your code to connect to the db should look something like this...

PHP:
<?
// hostname or ip of server
$servername='localhost';

// username and password to log onto db server
$dbusername='';
$dbpassword='';

// name of database
$dbname='mydb_name';

////////////// Do not  edit below/////////

connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
?>
 
Top