[SOLVED] MySQL Creating?
Moderator: General Moderators
[SOLVED] MySQL Creating?
Can anyone tell me how you can create a database with a code? Like a function? Im working an a RPG for a guy and i am new at MySQL sorry, This si probley a dumb question. And tehre really isnt a code to show you sence it is all new. And all it neads to do is get username and passwords from a database. Can anyone help me? Thanks.
Don't have the link right now but try a google search for the php db manager phpMyadmin. It's very easy to use.
However, you'll still have to figure out what column types you need and what to index - not to mention getting the privileges set up securely (allow users to connect with only the minimum privileges required).
More info on all that in the mysql manual at mysql.com.
Finally, if you're designing a database, you need to know about db normalisation and how to set up one-to-many and many-to-many relationships. Don't have my bookmarks right now or I'd give you a link to an excellent O'Reilly article on all that. Try google or pm me so I don't forget.
However, you'll still have to figure out what column types you need and what to index - not to mention getting the privileges set up securely (allow users to connect with only the minimum privileges required).
More info on all that in the mysql manual at mysql.com.
Finally, if you're designing a database, you need to know about db normalisation and how to set up one-to-many and many-to-many relationships. Don't have my bookmarks right now or I'd give you a link to an excellent O'Reilly article on all that. Try google or pm me so I don't forget.
Thanks
Thanks alot
Ill try google haha, Its actully for a guy that wont let me into his sever fpt or nothing
so im trying to make it all set up so i can do it with my PHP coding well anyways thanks alot!
it's actually pretty easy.
may want to encrypt the password though. up to you. that's just a short and simple way to do it.
Code: Select all
<?php
//connect to mysql. will need the server address, a username, and a password
@mysql_pconnect('server_address', 'username', 'password') or die(mysql_error());
$createdb = "CREATE Database db_name_here";
$result = mysql_query($createdb) or die(mysql_error());
mysql_select_db('db_name_here') or die(mysql_error());
$sql = "create table users(username varchar(20), pass varchar(20)";
$query = mysql_query($sql) or die(mysql_error());
?>