PDA

View Full Version : SQL Database Creation


techgy
09-11-2006, 05:31 PM
I'm relatively new to BH having recently moved our domain from elsewhere.
I would like to set up a database on our site, but I'm not familiar with the process of working with an SQL database. Most of my experience has been with MS Access (sorry about that).

I've checked the help files and managed to create a database, but I have no idea as to how to get data into the database nor how to link it into our web, which is created and published using Frontpage (don't knock it - it works).

I could use some basic guidance with the above. Any help would be appreciated.

Techgy

dkinzer
09-11-2006, 07:15 PM
There are articles in the knowledgebase (http://helpdesk.bluehost.com/kb/index.php?x=&mod_id=2&root=7) that illustrate how to import data into a database. Of course, to do that you either have to create the SQL queries that add the records or export from an existing SQL database.

Also, there are many good books out there on SQL in general and MySQL and other SQL databases in particular.

techgy
09-12-2006, 07:48 AM
Thanks for the response. However, I've already been through the information in the Knowledgebase. As for purchasing a book, that's a last resort, but a possibility.

What I'd really like to find is an on-line example of setting up an SQL database and connecting it into a FrontPage web site. Anything simple would be fine, I'm just looking for something that would "turn the lights on".

Thanks

dkinzer
09-12-2006, 09:20 AM
What I'd really like to find is an on-line example of setting up an SQL database and connecting it into a FrontPage web site.
To create a data driven web page you need to use a server-side scripting langauge. HTML by itself cannot do the job. PHP is a commonly used server-side scripting language as are Perl and Python but there are others as well.

You need to learn all about LAMP (Linux, Apache, MySQL and Perl/Python/PHP). This technology is, I would guess, the basis of most of the data driven websites hosted here. There are tutorials in various places on the web that explain how to get started, see the tucows page (http://farm.tucows.com/blog/_archives/2005/5/23/880104.html).

boppinbob
09-23-2006, 10:16 PM
You need a CMS like Joomla. It uses lamp. HTML and Frontpage are dead, dead dead.

dkinzer
09-24-2006, 11:59 AM
HTML [is] dead, dead dead.
Not so. HTML is essential to web pages. Perhaps you meant that coding web pages solely in HTML is obsolete. That is closer to the truth, perhaps, but if you don't know any HTML you'll have a difficult time creating sophisticated, data-centric web pages no matter what server-side scripting language or CMS you choose.

bobdog
09-24-2006, 06:47 PM
HTML and Frontpage are dead, dead, dead.

For all you Star Trek fans, that was a famous quote from a show, "Trilane."

Don't chuck that html editor just jet, I still write in html, and it is quite effective.

But FrontPage is indeed dead, Dead, DEAD.

Perhaps you could give us some examples of the data you need to manage?

Basil
09-24-2006, 08:45 PM
You need a CMS like Joomla. It uses lamp. HTML and Frontpage are dead, dead dead.
content management lol

techgy
09-25-2006, 01:52 PM
The date is VERY simple. In fact, it's basically a flat-file database.
In any event it would be good experience to setting up a db on BH.

The data format is;

Name
Address
City
State
Zip
Phone
Email


All fields can be text format. Data is indexed (sorted) on the name field.

If I can get the basics going, then I can probably take it from there.
I've been dealing with MS servers for years and switching to BH is, well, different.

bobdog
09-25-2006, 03:29 PM
That should be pretty easy. First make a new database. In cPanel, click on SQL databases. Create a new database, add a user and password to that database. Now, click on the phpMyAdmin link on the bottom. Select your database. Click on the SQL tab. Run this SQL query in the window:

CREATE TABLE `clients` (
`Name` varchar(100) NOT NULL default '',
`Email` varchar(100) NOT NULL default '',
`Address` varchar(255) NOT NULL default '',
`City` varchar(50) NOT NULL default '',
`State` varchar(50) NOT NULL default '',
`Country` char(2) NOT NULL default '',
`Phone` varchar(20) NOT NULL default '',
`Zip` varchar(6) NOT NULL default '',
) TYPE=MyISAM;

techgy
09-25-2006, 06:37 PM
Guess I'm not doing something right.
This is the reply when I try to run the SQL.

CREATE TABLE `clients` (
`Name` varchar( 100 ) NOT NULL default '',
`Email` varchar( 100 ) NOT NULL default '',
`Address` varchar( 255 ) NOT NULL default '',
`City` varchar( 50 ) NOT NULL default '',
`State` varchar( 50 ) NOT NULL default '',
`Country` varchar( 2 ) NOT NULL default '',
`Phone` varchar( 20 ) NOT NULL default '',
`Zip` varchar( 6 ) NOT NULL default '',
) TYPE = MYISAM ;

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') TYPE=MyISAM' at line 10

bobdog
09-26-2006, 09:45 AM
Oops, you're right. There was a mistake, try this:

CREATE TABLE `clients` (
`Name` varchar( 100 ) NOT NULL default '',
`Email` varchar( 100 ) NOT NULL default '',
`Address` varchar( 255 ) NOT NULL default '',
`City` varchar( 50 ) NOT NULL default '',
`State` varchar( 50 ) NOT NULL default '',
`Country` varchar( 2 ) NOT NULL default '',
`Phone` varchar( 20 ) NOT NULL default '',
`Zip` varchar( 6 ) NOT NULL default ''
)

Just tried it, it works.

The offending character was a , at the end of Zip line.

techgy
09-26-2006, 09:52 AM
Thanks for the tip. It worked! Hurray!
One more stupid question - how do I get data into the fields?

bobdog
09-26-2006, 10:39 AM
I figured you would ask

$insert = "INSERT INTO clients VALUES('$_POST[Name]', '$_POST[Email]', '$_POST[Address]', '$_POST[City]', '$_POST[State]', '$_POST[Country]', '$_POST[Zip]', '$_POST[Phone]' )";

$insert = mysql_query($insert) or die (mysql_error());

techgy
09-26-2006, 01:12 PM
Thanks for the assist.
The code to enter the data didn't work, but I found a method of inputting the data from a CSV file which did. Problem resolved for the time being.

Thank You.:)

redsox9
09-26-2006, 06:06 PM
Hi, techgy:

Jumping in a little late here - looks like bobdog has solved most of your issues - but I have also found phpMyAdmin useful as well in managing databases, especially if you are developing your own unique content management pages. It took me a few tries to figure out the system but once you get "it" I've found that it makes like very simple.

FYI, you can reach phpMyAdmin through the BlueHost cPanel. Just my two cents... good luck!

Oh, and yes, HTML is not dead by any means. :D