Jump to content

PHP / MySQL Database online


chosendesigns

Recommended Posts

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

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.

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?

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?

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..

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?

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.