Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 10-05-2008, 04:15 AM   #1 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Setting up a basic MySQL database of keywords

For my hermit crab site, I want to set up a basic database storing the names of foods that hermit crabs can or cannot eat.

Here's my idea of how it works: The database will contain the names of foods (eg. "Dried shrimp, "Apple") listed under particular categories (eg. "Fruit", "Meat", "Rich in calcium"). Of course, some foods will be rich in multiple properties, so "Dried shrimp" could be listed under both "Meat" and "Rich in calcium". Visitors will use a dropbox to browse through the categories available (eg. "Fruit", "Meat", "Rich in calcium"). Once a category in the drop box has been selected, an iframe (or something that functions in a similar manner) under the dropbox will return the names of foods listed under the selected category (eg. "Dried shrimp", "Apple"). Along with the name of each food, I also want to add a brief description about how to prepare each of the foods (eg. for apple, I could add "Slice into tiny pieces").

How do I go about setting something like the above up? Sorry if that sounds confusing, but I've never tried setting up a database myself from scratch. I do have some experience editting the data in a MySQL database though.

Let me know if you need more details or clarification.

Thanks!
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...

Last edited by HCP; 10-05-2008 at 04:17 AM.
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 10-05-2008, 03:14 PM   #2 (permalink)
Moderator: Design
 
dm01's Avatar
 
Join Date: Oct 2006
Location: Richmond, B.C.; Canada
Posts: 1,443
OS: Windows XP [Version 5.1.2600] SP3 | Ubuntu Jaunty Jackalope | Windows 7 BETA

My System

Re: Setting up a basic MySQL database of keywords

Try setting up an Access database or Excel spreadsheet to lay out your information. You can transfer the information from the database or spreadsheet into the MySQL database quite easily once you're ready to do so.
__________________


Validate your Markup Validate your CSS Notepad++
Please use [html], [php], and [code] when posting code or markup.
I do not help by Private Message or e-mail. If for some reason I have over-looked a reply to a thread that I have previously replied to, then send me a message.
dm01 is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-05-2008, 03:14 PM   #3 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,880
OS: Vista, various linux distros


Re: Setting up a basic MySQL database of keywords

Hey, from what you've said i'd suggest having about 2 tables:

1) Foods
- FoodID(Primary key)
- FoodName(20 chars or so string)
- PreperationDetails(500 chars or so string)
2) FoodType
- EntryID(a primary key)
- FoodID(Foreign Key)
- TypeOfFood(20 chars or so string)

The above would allow you to have more than one category for each food, and you could do what you've said. Do you have a testing server installed? if you do and you have mySQL ready to use the commands to create these tables would be something along the lines of:
Code:
CREATE TABLE Foods(FoodID int not null auto_increment, primary key(FoodID), FoodName varchar(20), PreperationDetails varchar(500));
The above would create the first table with the spec above.
Code:
CREATE TABLE FoodTypes(EntryID int not null auto_increment, primary key(EntryID), FoodID int, foreign key(FoodID) references Foods(FoodID), TypeOfFood varchar(20));
That code would create the second table i talked about.

As for the server-side code behind it it depends on what language you're using so post back with that info...

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-06-2008, 05:45 AM   #4 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

Here are my details:

PHP version: 5.2.6
MySQL version: 4.1.22-standard
cPanel Version: 11.23.4-STABLE
cPanel Build: 26138

I do have access to setting up a new database and running entries. However, I've never tried setting up a database from scratch. I have a database for my phpBB3 forum and my Coppermine gallery.

I haven't exactly tried "programming" MySQL. I've only tried making minor edits (eg. changing the output text) but not making my own tables and data without the aid of someone else or a tool.
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-06-2008, 01:23 PM   #5 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,880
OS: Vista, various linux distros


Re: Setting up a basic MySQL database of keywords

Hey, these tutorials will probably be a big help to you:

http://www.w3schools.com/php/php_mysql_intro.asp

They shouldn't take too long to go through(not longer than explaining the process over this thread) and they're extreemly helpful.

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-07-2008, 01:13 AM   #6 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

Ah, that's something like what I've been looking for. I'll let you know if I need more help.
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-09-2008, 12:00 AM   #7 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

Okay, after having a read through some pages about PHP and MySQL online, I'll describe what I'm aiming to do in less confusing terms.

Basically, I have some data stored in my database (eg. "Fish", "Shrimp", "Apple", "Mango"). I will have a form that acts as a search function for visitors. They can select various criteria to filter the data and display only the entries that satisfy the criteria that they have selected from the form (eg. through check boxes, drop boxes, radio buttons etc). For example, if I only had those four terms I mentioned in the database, and the visitor selects the criteria that only entries that have been labelled by me as a "Fruit" will be displayed. I am likely to have entries that will have multiple labels, so I wish to allow the visitors enter multiple criteria.

Which tutorial is best for meeting my needs? I hear a lot about databases being hacked, so I want to know about any recommendations you have.

Thanks!
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...

Last edited by HCP; 10-09-2008 at 12:01 AM.
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-10-2008, 04:45 PM   #8 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Question Re: Setting up a basic MySQL database of keywords

I couldn't exactly find a tutorial that made sense, so I'll just let you know what I've done so far.

The name of my database is hcpar_food.

For the food table, I have the following:
food_id (Primary key) - ID numbers of the food listed
food_name (50 chars or so string) - Names of the food
food_note (500 chars or so string) - Any additional notes

For the cat table, I have the following:
cat_id (Primary key) - ID numbers of the categories
food_id (Foreign key) - Names of the food (Yes?)
cat_name (50 chars or so string) - Names of the categories

What do I need to do next? How do I set up the PHP form and the variables?
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-10-2008, 06:04 PM   #9 (permalink)
Moderator, TSF Articles
 
carsey's Avatar
 
Join Date: Aug 2006
Location: Hunwick, Co. Durham England
Posts: 10,678
OS: XP Pro SP3

My System

Send a message via MSN to carsey
Re: Setting up a basic MySQL database of keywords

What do you want to do???

Have a form where you can submit data into a table?

Echo the data in tha table onto a webpage?
__________________

carsey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-10-2008, 06:15 PM   #10 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

No, I don't want my visitors to be able to add any new data to the database. I want the form to act as a search function, but without any typing fields. They "fill out" the form by selecting criteria and then the information from the database that meets their criteria will be echoed onto a webpage.
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 10-16-2008, 01:27 AM   #11 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

I hate doing this, but *bump*. How do I set up the PHP criteria form?
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-01-2008, 07:36 AM   #12 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

*bump*
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-13-2008, 05:33 PM   #13 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

*bump*
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-14-2008, 04:38 PM   #14 (permalink)
Moderator, TSF Articles
 
carsey's Avatar
 
Join Date: Aug 2006
Location: Hunwick, Co. Durham England
Posts: 10,678
OS: XP Pro SP3

My System

Send a message via MSN to carsey
Re: Setting up a basic MySQL database of keywords

So, just to recap. You want to be able to search a mysql database and echo the results in a table on the webpage for visitors to look at?
__________________

carsey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-14-2008, 05:25 PM   #15 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

Yes. I want to build a PHP form for visitors that acts as a search function with filtering criteria. Only data that matches the criteria that the visitor selects will be echoed. How do I set all this up? I've read through the tutorials, but I still don't know how to get started. All I've done so far is set up the database and the tables that I mentioned before.
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-14-2008, 08:23 PM   #16 (permalink)
Moderator, TSF Articles
 
carsey's Avatar
 
Join Date: Aug 2006
Location: Hunwick, Co. Durham England
Posts: 10,678
OS: XP Pro SP3

My System

Send a message via MSN to carsey
Re: Setting up a basic MySQL database of keywords

Leave it with me and Ill have a go.

Do you want the results displaying in a table?
__________________

carsey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-14-2008, 08:29 PM   #17 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

Yes, a table would be good. Thank you so much! I really appreciate your assistance.

Below are the names of the tables/values.

Quote:
Originally Posted by HCP View Post
The name of my database is hcpar_food.

For the food table, I have the following:
food_id (Primary key) - ID numbers of the food listed
food_name (50 chars or so string) - Names of the food eg. Tuna, Oak leaves
food_note (500 chars or so string) - Any additional notes, such as how to cook the food

For the cat table, I have the following:
cat_id (Primary key) - ID numbers of the categories
food_id (Foreign key) - Names of the food (Yes?)
cat_name (50 chars or so string) - Names of the categories eg. Vegetable, Meat
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...

Last edited by HCP; 11-14-2008 at 08:32 PM.
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-14-2008, 08:38 PM   #18 (permalink)
Moderator, TSF Articles
 
carsey's Avatar
 
Join Date: Aug 2006
Location: Hunwick, Co. Durham England
Posts: 10,678
OS: XP Pro SP3

My System

Send a message via MSN to carsey
Re: Setting up a basic MySQL database of keywords

Thanks

To help me understand how you want the outputted results to look, could you draw me up a picture so I can understand what you need it to look like.

Chris
__________________

carsey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-14-2008, 09:05 PM   #19 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

Something like this:

(Criteria form is above results table)

Code:
+-------------+------------------------------+
| Name        | Notes                        |
+-------------+------------------------------+
| Tuna        | Fresh tuna only. Not canned. |
+-------------+------------------------------+
| Oak leaves  | Serve uncooked, but cleaned. |
+-------------+------------------------------+
etc.

As for the criteria form, I want it to include:

- A drop-down list with "Show All" and "Criteria". By default, have "Show All" highlighted. Every other part of the form except the submit button is faded or unable to be selected. However, if "Criteria" is selected, then the other sections of the form are able to be selected.

If "Criteria" is selected, then the following may be filled in:

- A drop-down list of the letters of the alphabet, so visitors can filter the data for foods beginning with a particular letter only

- Checkboxes labelled with the categories (eg. "Vegetable", "Fruit", "Meat", "Calcium rich"). This way, visitors can select as many categories as they want, as some foods will be listed under multiple categories (eg. "Tomato" will be listed under both "Vegetable" and "Fruit"). However, is it possible to add an "and" or "or" rule, where "and" requests only foods that are listed in both categories, while "or" requests any foods that match one, two or all the categories selected?

- A drop-down list with the choices of "Allowed" and "Forbidden" so visitors can filter the results for foods that are allowed to be offered or not

- Of course, a submit button labelled "Submit".

I forgot to mention this in my earlier posts, but for the names of the foods that will be displayed in the results table, I want to make the text colour of the foods that are "Allowed" green and those that are "Forbidden" to be in red. Do I have to set up another SQL table for something like that?

I am willing to credit you on the page. If you are interested, let me know what you would like me to credit your name as.
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...

Last edited by HCP; 11-14-2008 at 09:25 PM.
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 11-20-2008, 11:35 PM   #20 (permalink)
HCP
Registered User
 
Join Date: Apr 2006
Location: Australia
Posts: 73
OS: Windows XP Professional


Re: Setting up a basic MySQL database of keywords

By no means am I trying to rush you, carsey, but am I asking for too much? If there is something that is really bugging you, please let me know and I'll see if I can think of a way around it.
__________________
HCP
I can read HTML, CSS and a bit of JavaScript and PHP... if that really helps...
HCP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 02:00 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85