i have a script here...dont laugh at it im only a newbie php builder
<?php
if ($section=="1") {
echo("
<form method=\"post\" action=\"install.php?section=2\"><b>Database Host:</b> (default: localhost) <input type=\"text\" name=\"dbhost2\" value=\"localhost\"><br>
<b>Database Username:</b> <input type=\"text\" name=\"dbuser2\"><br>
<b>Database Password:</b> <input type=\"text\" name=\"dbpass2\"><br>
<b>Database Name:</b> <input type=\"text\" name=\"dbname2\"><br><br>
<input type=\"submit\" name=\"section_2\" value=\"Proceed to section 2> Installing the database\">
</form>");
}
else if ($section=="2") {
if (!$dbhost2) {
echo("<a href=\"install.php?section=1\">Go back and enter a database host</a>");
}
else if (!$dbuser2) {
echo("<a href=\"install.php?section=1\">Go back and enter a database username</a>");
}
else if (!$dbpass2) {
echo("<a href=\"install.php?section=1\">Go back and enter a database password</a>");
}
else if (!$dbname2) {
echo("<a href=\"install.php?section=1\">Go back and enter a database password</a>");
}
else {
$dbhostadd="$dbhost2;";
$dbnameadd="$dbname2;";
$dbuseradd="$dbuser2;";
$dbpassadd="$dbpass2;";
$writedbhost = fopen("dbhost.txt","w+");
fwrite($writedbhost, $dbhostadd);
$writedbname = fopen("dbname.txt","w+");
fwrite($writedbname, $dbnameadd);
$writedbuser = fopen("dbuser.txt","w+");
fwrite($writedbuser, $dbuseradd);
$writedbpass = fopen("dbpass.txt","w+");
fwrite($writedbpass, $dbpassadd);
$host = fopen("dbhost.txt", "r");
$name = fopen("dbname.txt","r");
$user = fopen("dbuser.txt","r");
$pass = fopen("dbpass.txt","r");
$register=session_register("dbhost2","dbname2","dbuser2","dbpass2");
$session=session_id();
mysql_connect("$host","$user","$pass");
mysql_select_db("$name");
but it wont connect after i do all that... this is the error
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL Server Host 'Resource id #6' (1) in /home/buffysea/public_html/indexed/install.php on line 55
Sorry, the table settings could not be created!