|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I am not sure if this can be done in PHP... but if so, I wonder if anyone out there might lend a hand and help me to do it!!
I need to set one PHP script, which, when called it will set up a default user account in 'user' table, and set up the remaining tables... I want to set up around 5 tables with content... and I need to create the install file. I already have all the SQL to insert the data in to the tables, and it works when I run install.sql in myPHPadmin. BUT..... I want to create install.php which anyone can run on their server and it sets up all the tables. do I need to create the default user, or would the user have to log in to MyPHPadmin to create the database? is this clear....?!! hehe! |
|
#2
|
|||
|
|||
|
firslty create a form, that collects the user database info, like server, username and password, and database name, when they submit, create a database.php doc, and store the variables in there, then use those variables to connect to the server and create your datbase and tables
|
|
#3
|
|||
|
|||
|
or if you don't want to use ph pfile functions
just make an easy to edit config file that's included in your install.php script. all you need it to contain is the server-specific info to connect to mysql, ie. hostname, username, password, and database to connect to. You can go ahead and connect in the config file too, to keep it neat.
In your main file, just run your queries one after the other until they're all finished. You won't typically need to walk the user through making any mysql configuration changes, because more often than not they either set it up themselves or have a web host that set it up for them, and in either case have the login info needed to add tables. if you need to have them create some user, you can do it by having them run the mysql shell as the root user, and entering a single command. shell> mysql --user=root password mysql> GRANT ALL PRIVILEGES ON *.* TO username IDENTIFIED BY password; Of course username/password will be specific to the server, and you can have the privileges more selective, but that will set a user up. If you want more restrictive permissions, you can give the user insert only permissions, just to that database, but there's no real need to do this. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > a challenge for all..... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|