onei0120 Posted July 4, 2009 Share Posted July 4, 2009 I have just purchased webspace and i need to make a database to hold values from an html form.. how do i create a database and implement it on the server?! how do i make mySQL work? and php help?! Please someone! anyone! Quote Link to comment https://forums.phpfreaks.com/topic/164772-database-help/ Share on other sites More sharing options...
neekworld Posted July 4, 2009 Share Posted July 4, 2009 first do you have any code that you are using? you said you just purchased webspace. so your hosting service should give you some kind of admin access to set up a database. i have one with 1and1.com and depending on the package you purchased you should have access to where you are saving your files on the server. the main admin screen allows you to select database and once in there its kinda like using phpMyAdmin if you have used it before. all you do is say create database, then create the tables you need in the database, then create fields in your tables for what you need to save. good way to test this is WAMP. it sets up an Apache server on your local machine so you can test your php, mysql and webpages before you upload to the main site you will be using. here is the web page to download it. http://www.wampserver.com/en/ its fairly simple to set up and once you have running. you may need to "install" some of the php classes. by "install" i mean all you have to do is go into the wamp server, click php, then click extension and find the class you need. ie you may need to install certain things such as zip extension. i use the wamp server in conjunction with dreamweaver CS3. if you are using dreamweaver you have to set up a connection to the wamp. on the manage sites link all you have to do is select testing server, set the server mode to php/mysql, access to local/network, testing server folder where you are saving the files usually in C:\wamp\www\(your site here), and set the url prefix to the same as in the same as the server folder not the same "/" just add your site after the / it puts in Quote Link to comment https://forums.phpfreaks.com/topic/164772-database-help/#findComment-868899 Share on other sites More sharing options...
The Eagle Posted July 4, 2009 Share Posted July 4, 2009 Dependent on your host, most hosts do allow the creation and usages of MySQL databases. Your control panel, quite possibly may be cPanel, you have an option if you scroll down the page quite a bit. You will need to identify your database to your HTML form, too. Quote Link to comment https://forums.phpfreaks.com/topic/164772-database-help/#findComment-868908 Share on other sites More sharing options...
neekworld Posted July 4, 2009 Share Posted July 4, 2009 yes you will need to do that as well. either directly in the page or via an include file. i like to do the include file because if i change the password or database i only need to change one file versus changing all the pages that need access to the database Quote Link to comment https://forums.phpfreaks.com/topic/164772-database-help/#findComment-868909 Share on other sites More sharing options...
newbtophp Posted July 4, 2009 Share Posted July 4, 2009 To create a MySql database. Theirs a link when you login to your cpanel named "MySql". Just follow the instructions and input the fields (database name). When your done, you can use php and add the following code your form. (Input the mysql info within each variable) <?php //Database Host, Usually localhost $db_host="localhost"; //Database Username $db_user="Your database username"; //Database Password $db_password="Your password"; //Database $db="Database name"; //Connection to the Database mysql_connect($db_host,$db_user,$db_password) or die ("No connection possible"); mysql_select_db($db) or die ("The database does not exist"); ?> Make sure to name the file as a .php extension. If you need further help post here, or use google theirs some good tutorials. Quote Link to comment https://forums.phpfreaks.com/topic/164772-database-help/#findComment-868917 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.