Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Jason Atkinson
Jason Atkinson
26,245 Points

mysql + php

hi so ive been following the php track and have worked my way threw most of it. ive been working on my own project making a php form submit to a database and then on a different page displaying this information in a basic table for the time being. my problem is that i set up mysql and php code in my localhost using xamp and phpmyadmin... i haven't used workbench as i couldn't get it to work but i was lead to believe that phpmyadmin does all of the same things. my problem is how do i upload it from hear ive always just pulled my files into filezilla in the past im not sure if its that easy or if im just not copy everything i should be?

3 Answers

Thomas Ireland
PLUS
Thomas Ireland
Courses Plus Student 8,216 Points

Hey, Jason

How do you mean "upload from here"? Just trying to get a picture of what you're doing so I can try and help.

Cheers

Tom

Jason Atkinson
Jason Atkinson
26,245 Points

Hi Tom

Sorry i didn't make myself clear might be why i'm having no luck when i'm googling the problem either. at the moment when im uploading my files to my hosting i'm just uploading all the content (php files) and an exported version of mysql file and so when i navigate to the page it says could not connect to data base the if statement i wrote if it couldn't connect... since then ive come across talk about things such as cpanel is this what i need to manage and use my database on my hosting apposed to just on my localhost?

(hope this makes more sense)

Thomas Ireland
Thomas Ireland
Courses Plus Student 8,216 Points

Hi, Jason

Have you created a MySQL database on your server and imported the structure e.g. tables etc.?

Normally through cPanel - providing you have got the option with your particular hosting plan - you can create a MySQL database, add a user and assign appropriate privileges. cPanel also provides a number of other tools like FTP access etc.

Who's your host and what plan have you got?

Cheers

Tom

Jason Atkinson
Jason Atkinson
26,245 Points

Hi tom

  • im using a hosting of http://www.servage.net/home/ which says allows for up to 1000 sql data bases i havent created it on my hosting/server only my local host - a database called my_db and a table called forminfo ive only heard of cpanel i havent yet tried to use it as i now you have to pay for it and im not sure if it is what i need anyway?
Thomas Ireland
Thomas Ireland
Courses Plus Student 8,216 Points

Hey, Jason

cPanel is essentially a hosting control panel. Looking at servege.net, they have their own hosting control panel. They have some help information on creating a new database and importing a sql file. Check out their Wiki if you haven't done so already.

Jason Atkinson
Jason Atkinson
26,245 Points

cool i will look into that and see what i can find out if i run into any more problems i might need you help again :s

James Bullis
James Bullis
12,762 Points

cPanel is very convenient but you may be able to create a database and import your sql export. Once you have it set up, you will add in connection credentials to your php files that will tell the php files where to go. The database will give you the connection details like host, db name, db username, and password. If it doesn't give you a host, try localhost.