chosendesigns Posted April 24, 2008 Share Posted April 24, 2008 Hey there, Im a little confused about databases for specific websites. I have created a MySQL database and written all my PHP codes for a simple login and registration system, however it will only work when loaded from my wamp www folder. How do you go about setting up or connecting to a database from a webaddress (www.mydomain.com). Would it be simply changing the "host" part from localhost to something else in the mysqli_connect() function and if so what does it need to be changed to? I hope that made sense coz im not sure how to explain what I mean properly. Link to comment https://forums.phpfreaks.com/topic/102749-php-mysql-database-online/ Share on other sites More sharing options...
jonsjava Posted April 24, 2008 Share Posted April 24, 2008 a couple questions: 1: are you keeping everything else the same, except how you are requesting the file? 2: have you changed hosts, or are your php files now on a different server than the MySQL database? if the answer to 1 is "yes" and the answer to 2 is "no", then it's most likely a firewall issue, or your WAMP install does not allow connections from the outside world. Link to comment https://forums.phpfreaks.com/topic/102749-php-mysql-database-online/#findComment-526247 Share on other sites More sharing options...
chosendesigns Posted April 24, 2008 Author Share Posted April 24, 2008 What im saying is I created everything on my laptop.. I used phpMyAdmin to create the database and ive created all my php and html in notepad... When i load it in my browser on my computer using http://localhost/registration.php it all works fine, the user information gets added to the database etc. but when i then upload the files to my webserver www.mydomainname.com it no longer adds the information to my database. Im guessing this is to do with the 'localhost' part of the connection but im not sure of what needs doing to change it and whether I need a database setup on the server rather than using phpMyAdmin on my PC? Link to comment https://forums.phpfreaks.com/topic/102749-php-mysql-database-online/#findComment-526323 Share on other sites More sharing options...
craygo Posted April 24, 2008 Share Posted April 24, 2008 Where is the database for you domain. Some host do not have the databases on the local machine. Check with your hosting company to see where it is. Ray Link to comment https://forums.phpfreaks.com/topic/102749-php-mysql-database-online/#findComment-526344 Share on other sites More sharing options...
chosendesigns Posted April 24, 2008 Author Share Posted April 24, 2008 Basically its a project im doing for somebody else but does it mean they have to get a new databse setup by their own webhosts rather than me doing it all on my computer... I dont know much about databases, is it held as an external file when I created it in phpMyAdmin or a file local to my computer? Link to comment https://forums.phpfreaks.com/topic/102749-php-mysql-database-online/#findComment-526352 Share on other sites More sharing options...
nitation Posted April 24, 2008 Share Posted April 24, 2008 Connecting to a database on your website requires the following: $hostname, $username, $password. The first thing you need is to verify whether your hosting company(where your domain was bought) support database like MYSQL. If they do, you then need to setup the username and password in the control panel before you can connect to the database. Hope this helps.. Link to comment https://forums.phpfreaks.com/topic/102749-php-mysql-database-online/#findComment-526356 Share on other sites More sharing options...
chosendesigns Posted April 24, 2008 Author Share Posted April 24, 2008 would the hostname be localhost or www.mydomain.com or does this change between hosts. Ok.. so is there a way of connecting phpMyAdmin to this database so i can add, edit, view and delete tables with it rather than having to send it pure text based SQL Queries? Link to comment https://forums.phpfreaks.com/topic/102749-php-mysql-database-online/#findComment-526431 Share on other sites More sharing options...
chosendesigns Posted April 24, 2008 Author Share Posted April 24, 2008 ok.. ive managed to connect to the database on my webserver now. I found the information coz its being hosted by someone else. Ive setup a database so now all I need to know is if there is a way of using phpMyAdmin to access that database to add tables with it rather than having to send SQL Queries everytime I want something changed Link to comment https://forums.phpfreaks.com/topic/102749-php-mysql-database-online/#findComment-526445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.