Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database host

Status
Not open for further replies.

sebell

Programmer
Oct 16, 2002
51
US
Hello all. I have a script that has settings for DB Username, DB Password, DB Name, and Table Name. I noticed that on some of my programs, they also ask for DB Host. This one does not. My website is hosted. Is there a way to add this functionality, or am I missing something in the code? I saw the following code in one of the files, and was wondering if I could just change it here where it says localhost, even though it is not in the config file? When I did try, nothing was posted to the table.


Code:
#########################################################################
# DATABASE FUNCTIONS                                                    #
#########################################################################
if ($Action == "D" or $Action == "ED" or $Action == "CD" or $Action == "DF"){

$Connect = @mysql_connect("[b]localhost[/b]", "$SQL_UserName", "$SQL_Password");
@mysql_select_db("$SQL_Database",$Connect);

while (list ($key, $val) = each ($_SQL))
{
 if ($key != "Settings" and $key != "Refresh")
 {
	$val = stripslashes($val);
	$val = str_replace('"','"',$val);
    $val = strip_tags($val);
	$Columns .= $key . ',';
    $Values .= "'" . $val . "',";
 }
}
if ($SQL_ENV == "1")
{
 $Columns .= "Received,IPAddress,Browser";
 $Values .= "'" . $Time . "','" . $IPAddress ."','" . $Browser . "'";
}
else
{
 $Columns = substr($Columns,0,-1);
 $Values = substr($Values,0,-1);
}

@mysql_query("INSERT INTO $SQL_Table ($Columns) VALUES ($Values)");
@mysql_close($Connect);

} // END OF ACTION

Thanks in advance...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top