derrick1123 Posted March 16, 2008 Share Posted March 16, 2008 <?php $db_host = $_POST['db_host']; $db_user = $_POST['db_user']; $db_password = $_POST['db_pass']; $db_name = $_POST['db_name']; //database info $db = mysql_connect($db_host,$db_user,$db_password) or die("Could not connect."); if(!$db) die("no db"); if(!mysql_select_db($db_name,$db)) die("No database selected."); //end database info ?> I have the other file that inserts the data...but I don't know to keep the information there. How is this possible? Quote Link to comment Share on other sites More sharing options...
trq Posted March 16, 2008 Share Posted March 16, 2008 Sorry, your question is? Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted March 16, 2008 Author Share Posted March 16, 2008 Like how do I write the database information to the db_settings.php. (which is what that file above is) Quote Link to comment Share on other sites More sharing options...
trq Posted March 16, 2008 Share Posted March 16, 2008 Nope, your going to need to try harder. Describe your actual problem, were not mind readers. Quote Link to comment Share on other sites More sharing options...
derrick1123 Posted March 16, 2008 Author Share Posted March 16, 2008 I have a form that lets the owners of the script enter in the information to the db_settings.php. Right now I have it only were it tempraily writes it to db_settings.php. I need to find out how to perminatly write the settings. Quote Link to comment Share on other sites More sharing options...
trq Posted March 16, 2008 Share Posted March 16, 2008 Theres a link in my signiture to a free book that might be a good place to start. Quote Link to comment Share on other sites More sharing options...
trq Posted March 16, 2008 Share Posted March 16, 2008 A simple example.... <?php // connect to db. if (isset($_POST['submit'])) { $data = mysql_real_escape_string($_POST['data']); $sql = "INSERT INTO tbl (data) VALUES ('$data')"; if (mysql_query($sql)) { if (mysql_affected_rows()) { echo "Data added to the database"; } } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.