_g3o_ Posted June 8, 2009 Share Posted June 8, 2009 i have a problem, i'm trying to write in a file but it looks that there is a problem. i have a function that writes in a file the config and then connects to the db to create the tables function installation_proc() { $host = $_SESSION["host"]; $dbuser = $_SESSION["dbnewusername"]; $dbpass = $_SESSION["dbnewpassword"]; $dbname = $_SESSION["dbnewname"]; $string = '<?php $host = "'.$host.'"; $dbuser = "'.$dbuser.'"; $dbpass = "'.$dbpass.'"; $dbname = "'.$dbname.'"; $lim = "6"; $template = "home.php"; ?>'; $fp = fopen("config.php", "w"); fwrite($fp, $string); fclose($fp); $fp = fopen("../news/config.php", "w"); fwrite($fp, $string); fclose($fp); $connection = mysql_connect($host, $dbuser, $dbpassword) or die("Unable to connect to MySQL"); mysql_select_db($dbname, $connection) or die("Unable to select DB!"); but is not working. i copy the same code in a test.php file and when i run it i show that wrote on the file. can any one help me pls? Link to comment Share on other sites More sharing options...
0 Deacon Frost Posted June 8, 2009 Share Posted June 8, 2009 What error are you getting? What context are you using the function in? Link to comment Share on other sites More sharing options...
0 _g3o_ Posted June 8, 2009 Author Share Posted June 8, 2009 What error are you getting?What context are you using the function in? im not getting any error. it just continues to execute the queries for the creation of tables and after the installation finish i open the config.php and is empty Link to comment Share on other sites More sharing options...
Question
_g3o_
i have a problem, i'm trying to write in a file but it looks that there is a problem. i have a function that writes in a file the config and then connects to the db to create the tables
but is not working. i copy the same code in a test.php file and when i run it i show that wrote on the file. can any one help me pls?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts