Hi all, I'm trying to create an installer, using a combination of fwrite and forms. Here's my code:
<?php
$myFile = "db_config.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, "$host = " . $_POST['host'] . ";\n $username = " . $_POST['username'] . ";\n $password = " . $_POST['password'] . ";\n $name = " . $_POST['name']";" ;);
fwrite($fh, 'mysql_connect("{$host}", "{$db_username}", "{$db_password}")\n or die(mysql_error());\n mysql_select_db("{$db_name}")\n or die(mysql_error()); ?>' ;);
fclose($fh);
?>
Here's the error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home2/runetyco/public_html/ballpointradio/new/install_action.php on line 4