rahber Posted April 15, 2010 Share Posted April 15, 2010 hello i am creating a databse using php .. i am using wamp server here is my code <title>Install database</title> <?php $server=""; $user="root; $password=""; $database=""; $con = mysql_connect($server,$user,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } if (mysql_query("CREATE DATABASE z_db",$con)) { echo "Database created"; } else { echo "Error creating database: " . mysql_error(); } mysql_select_db($database, $con); $sql = "CREATE TABLE rahber ( FirstName varchar(20), LastName varchar(20), FatherName varchar(20), PhoneNo int, Dob date, CGPA float )"; mysql_query($sql,$con); mysql_close($con); ?> All i want is that the values of $server $user $password $database should be entered from a text field when we run this file so that when each user open the file he can manual enter the values without editing the php code Link to comment https://forums.phpfreaks.com/topic/198629-how-to-get-a-databse-value-from-user/ Share on other sites More sharing options...
trq Posted April 15, 2010 Share Posted April 15, 2010 There is a book in my signature (Hudzilla) that has an entire chapter on handling forms with php. Link to comment https://forums.phpfreaks.com/topic/198629-how-to-get-a-databse-value-from-user/#findComment-1042343 Share on other sites More sharing options...
coupe-r Posted April 15, 2010 Share Posted April 15, 2010 I'm so confused... You want to let your users enter that information? 1. How would they know it? 2. THEY SHOULD NEVER KNOW THIS INFO! This information should be kept in a separate .php file with the information already entered and then called at the top of each of your pages. Maybe I'm misunderstanding. Link to comment https://forums.phpfreaks.com/topic/198629-how-to-get-a-databse-value-from-user/#findComment-1042399 Share on other sites More sharing options...
rahber Posted April 15, 2010 Author Share Posted April 15, 2010 hey thanks for the reply the thing is i want that when install.php runs it ask your for the database server,name,user,password... then it create that database and add tables.. then store the name ,server info into config.php file that can be used in other files also Link to comment https://forums.phpfreaks.com/topic/198629-how-to-get-a-databse-value-from-user/#findComment-1042419 Share on other sites More sharing options...
trq Posted April 15, 2010 Share Posted April 15, 2010 My original reply still stands. Link to comment https://forums.phpfreaks.com/topic/198629-how-to-get-a-databse-value-from-user/#findComment-1042445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.