Jump to content

Recommended Posts

Hi,

 

I have recently started building a website for a family members business. The business gives advice on different vitamins and supplements etc. I have a page that lists all of the vits & supps and an individual page for each. For example (http://artboxuk.net/lutein.html).

 

I've have little experience with PHP and MySql (I can create tables and insert data etc) and was wondering whether it would be possible to store the majority of data on these pages in a MySql database and use PHP to display the information in exactly the same way as it is on the current page.

 

I thought this way would save me time as well as being a good learning experience, but was unsure as to how to publish the data once it was stored in the database and if all of the data would be valid for a MySql database.

 

Does anybody have any useful tips or url's I could follow that would put me on the yellow brick road ?

 

Many Thanks

Link to comment
https://forums.phpfreaks.com/topic/142625-html-to-mysqlphp/
Share on other sites

I would do a quick google search on display results from MySQL using PHP or something to that affect. the task is very simple and there are a lot of good tutorials out there.

 

http://www.tizag.com/phpT/

 

The above URL is a good link to begin learning PHP

Link to comment
https://forums.phpfreaks.com/topic/142625-html-to-mysqlphp/#findComment-747570
Share on other sites

you mean like.. for the vitamin products?

 

like..

 

 

Name: Vitamin X

Price: $15.99/cont.

Description: Vitamin X, take 3 of these right before sexual intercourse to experience the best XXX imaginable.

 

(I hope I don't get banned for that.. LOL)

 

if so, than yes you can do that

 

make a mysql table

 

id - int - auto_increment - primary key -

name - text - -

price - text - -

description - text - -

 

then

just put all the vitamins names price and description into the database

 

then when you list them..

 

list them by ID

 

for example

 

product.php?id=10

 

then inside of product.php you'd do

 

"SELECT * FROM `products` WHERE `id` = '{$_GET['id']}'"

 

as your query

 

and then mysql_fetch_assoc the result resource

 

and then put

 

$theRowVar['price'] wherever the price should show up, same method for name and description

 

goodluck

Link to comment
https://forums.phpfreaks.com/topic/142625-html-to-mysqlphp/#findComment-747575
Share on other sites

Thank you both for the replies.

 

I suppose my main worry was that I might be undertaking something that would involve alot of complex PHP that would be out of my brain-box, and by the sound of the answers it doesn't seem to be that complex. Which is a relief =)

 

So I shall take a bit of advice from both and get cracking !

 

Thanks again chaps.

Link to comment
https://forums.phpfreaks.com/topic/142625-html-to-mysqlphp/#findComment-747676
Share on other sites

well if you do run into any roadblocks this is an awesome site to get help. just post your code as you run into problems! This site has helped me on MANY occasions

 

Awesome. Couldn't tell you how many times I've stumbled across unhelpful forums!

 

I shall mark this as solved until my next inevitable post =)

Link to comment
https://forums.phpfreaks.com/topic/142625-html-to-mysqlphp/#findComment-747717
Share on other sites

Hi,

 

I have recently started building a website for a family members business. The business gives advice on different vitamins and supplements etc. I have a page that lists all of the vits & supps and an individual page for each. For example (http://artboxuk.net/lutein.html).

 

I've have little experience with PHP and MySql (I can create tables and insert data etc) and was wondering whether it would be possible to store the majority of data on these pages in a MySql database and use PHP to display the information in exactly the same way as it is on the current page.

 

I thought this way would save me time as well as being a good learning experience, but was unsure as to how to publish the data once it was stored in the database and if all of the data would be valid for a MySql database.

 

Does anybody have any useful tips or url's I could follow that would put me on the yellow brick road ?

 

Many Thanks

 

just a quick thumbs up, the way your thinking about it is spot on. You will be saving yourself time in the long run having everything in a database and also be able to do lots of cool stuff with your data if you ever need to.

Link to comment
https://forums.phpfreaks.com/topic/142625-html-to-mysqlphp/#findComment-747723
Share on other sites

Ok, so I have looked at the page I want PHP'd and decided to use the following tables and fields to incorporate the data.

 

Table 1

 

vitamin_ID >> Auto Increment >> Primary Key

vitamin_name >> varchar(30)

vitamin_description >> varchar(200)

 

 

Table 2

 

vitamin_ID >> Auto Increment >> Foreign Key ?

vitamin_Name >> varchar(30)

vitamin_ingredient >> varchar(50)

measurement >> varchar(10)

 

Couple of questions here ???

 

[*] Would this be a valid way of having my data laid out, I read something about normalisation and that having more than one table was often a way to make a database more efficient.

[*]Would I have to include the vitamin_ID field as a foriegn key in the second table so the table has a key'd field (if that makes sense).

[*]How could I cycle through my 2nd table to print the values into a table as they are in http://www.artboxuk.net/smokerade.html I have done this with ASP using the U-Bound feature with an array, is this the same with data in a relational database ?

 

Apologies for any blatant misunderstandings on my part, this stuff is all new and exciting to me =)

Link to comment
https://forums.phpfreaks.com/topic/142625-html-to-mysqlphp/#findComment-747807
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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