| | |
Database - CPanel
Please support our Database Design advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
![]() |
•
•
Join Date: Jun 2009
Posts: 34
Reputation:
Solved Threads: 0
A friend referred me to this forum knowing I've been struggling for quite a while unable to find proper help. She says the people here are excellent and quick to respond. I do hope I am posting this is the correct forum area.
My problem is is that I have a website hosted and my host allows me to use CPanel to create databases. However, I am unsure how the heck to implement these databases in my website in any sort of way. I hope that someone here knows how to use CPanel and could help me with this issue because my website would be much more fantastic if only I could use databases. Please help me out.
My problem is is that I have a website hosted and my host allows me to use CPanel to create databases. However, I am unsure how the heck to implement these databases in my website in any sort of way. I hope that someone here knows how to use CPanel and could help me with this issue because my website would be much more fantastic if only I could use databases. Please help me out.
•
•
Join Date: Jun 2009
Posts: 34
Reputation:
Solved Threads: 0
Ok. Let me explain my issue a little better.
I've used CPanel to create databases, I give them a name, I apply a user to them, and in PHPMyAdmin I can create tables and add data to the tables. Now, what I need to know, is how to get my website to search these databases? How do I show this data on my website according to what link is selected, so its pulled from the database what is shown?
I've used CPanel to create databases, I give them a name, I apply a user to them, and in PHPMyAdmin I can create tables and add data to the tables. Now, what I need to know, is how to get my website to search these databases? How do I show this data on my website according to what link is selected, so its pulled from the database what is shown?
You'll need a language to connect to them, for example PHP, Python, Ruby.
In PHP the code would look like this:
In PHP the code would look like this:
php Syntax (Toggle Plain Text)
$db_link = @mysql_connect('localhost', 'youruser', 'yourpass') or die(mysql_error()); @mysql_select_db('yourdatabase') or die(mysql_error()); $query = 'SELECT * FROM yourtable'; $result = @mysql_query($query) or die(mysql_error()); if ($result) { while ($row = mysql_fetch_assoc($result)) { // use your data } mysql_free_result($result); } if ($db_link) mysql_close($db_link);
Last edited by pritaeas; Jun 29th, 2009 at 10:04 am.
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
•
•
Join Date: Jun 2009
Posts: 34
Reputation:
Solved Threads: 0
Yea, I knew to use PHP, guess I should have said that. But thank you. That's a start. I don't know PHP but the best way to learn is hands on. So, I'm guessing all that connects me to the server, but then, what do I put in the "// use your data" area? Like, could you point me in the right direction of where to learn what goes there? I use w3schools to learn the web languages including PHP. However, all I seem to find on there is code that creates the database as well as insert data in it. But CPanel already does that..?
Last edited by Spunky; Jun 29th, 2009 at 5:51 pm.
•
•
Join Date: Jun 2009
Posts: 27
Reputation:
Solved Threads: 1
first of all you need a goal,
like me I have a site where you can add songs and lirics to it, so a user enter the site, selects its church and then sees a list of songs that his church plays, so the "//use your data" becomes title songs and authors name, and lirics.
if you have a goal already, tellus what is it that you want to do and that should help us determine what to show you.....
like me I have a site where you can add songs and lirics to it, so a user enter the site, selects its church and then sees a list of songs that his church plays, so the "//use your data" becomes title songs and authors name, and lirics.
if you have a goal already, tellus what is it that you want to do and that should help us determine what to show you.....
•
•
Join Date: Jun 2009
Posts: 34
Reputation:
Solved Threads: 0
Alright then. My website is a World of Warcraft Fansite. It isn't official yet and probably wont be for a very long time. But I am ok with that, this is a learning experience.
To start out with getting a database going I'm starting with the Achievements page. In the game you can earn different achievements by accomplishing certain tasks. There are hundreds of achievements and they are listed into different categories. I.E Quests, General, Exploration, Professions. Things like that. I want it to be like where you click on a link, say, Quests, and then it lists all of the Quest achievements out that are stored in the database, and all the info that is stored with it, like how many achievement points it awards and the description of how to accomplish it. I want to be able to make it cool looking though ofcourse, not just list it in a table. But I have to start out with the basics. I'd be exstatic just to get my info to show on my page from my database.
To start out with getting a database going I'm starting with the Achievements page. In the game you can earn different achievements by accomplishing certain tasks. There are hundreds of achievements and they are listed into different categories. I.E Quests, General, Exploration, Professions. Things like that. I want it to be like where you click on a link, say, Quests, and then it lists all of the Quest achievements out that are stored in the database, and all the info that is stored with it, like how many achievement points it awards and the description of how to accomplish it. I want to be able to make it cool looking though ofcourse, not just list it in a table. But I have to start out with the basics. I'd be exstatic just to get my info to show on my page from my database.
This will print just one column name:
Play around with it first, and when you have new/more questions, post them.
In addition, it may be worthwhile to check out Smarty, to be able to separate your data from your layout. (smarty.net)
php Syntax (Toggle Plain Text)
while ($row = mysql_fetch_assoc($result)) { // use your data echo $row['column_name'] . '<br/>'; }
Play around with it first, and when you have new/more questions, post them.
In addition, it may be worthwhile to check out Smarty, to be able to separate your data from your layout. (smarty.net)
"If it is NOT source, it is NOT software."
-- NASA
-- NASA
•
•
Join Date: Jun 2009
Posts: 34
Reputation:
Solved Threads: 0
Hey yea, that's actually what I tried doing with something that I found on w3schools. Except it was to show 2 column names at same time. But whatever. I couldn't get it to work. But I think I just figured it out. I put what you just told me to put in and it WORKED! OMG I love you! I have been trying to get data to show up for MONTHS! I just couldn't find the php that it took to connect to my database! Ahhhh this is a happy day.
Ok ok ok, so, how do I be hands on with my data? Like Right now it shows that one column when you go to that specific page. But, how do I stay on that same page and have a link clicked to show a different column? I'll try to figure it out myself now that I know the basics it will make it soo much easier. I want to get all the links set up first though before I try to make the data fancy.
Also another question. Is it possible to store images in a database? Can't figure it out in CPanel but it must be possible cuz I know that places that sell merchandise the images of them are stored in databases.
Ok ok ok, so, how do I be hands on with my data? Like Right now it shows that one column when you go to that specific page. But, how do I stay on that same page and have a link clicked to show a different column? I'll try to figure it out myself now that I know the basics it will make it soo much easier. I want to get all the links set up first though before I try to make the data fancy.
Also another question. Is it possible to store images in a database? Can't figure it out in CPanel but it must be possible cuz I know that places that sell merchandise the images of them are stored in databases.
![]() |
Similar Threads
- help im getting error with syntax on this registration script (MySQL)
- Free Social Web Hosting - 0bones.com (Web Hosting Deals)
- Need PHP/MYSQL database help (PHP)
- Check and Repair MySQL Database (MySQL)
- Database and web design (MySQL)
- Copying a database to another server (MySQL)
- show content from another sites's database (PHP)
- Automatic email creation in cpanel ----PHP (PHP)
- Remotly Hosted MySQL Database (MySQL)
Other Threads in the Database Design Forum
- Previous Thread: Database Newbie
- Next Thread: ERD for social networking website
| Thread Tools | Search this Thread |





