Ordillus86 Posted January 27, 2009 Share Posted January 27, 2009 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 Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted January 27, 2009 Share Posted January 27, 2009 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 Quote Link to comment Share on other sites More sharing options...
RussellReal Posted January 27, 2009 Share Posted January 27, 2009 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 Quote Link to comment Share on other sites More sharing options...
Ordillus86 Posted January 27, 2009 Author Share Posted January 27, 2009 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. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted January 27, 2009 Share Posted January 27, 2009 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 Quote Link to comment Share on other sites More sharing options...
Ordillus86 Posted January 27, 2009 Author Share Posted January 27, 2009 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 =) Quote Link to comment Share on other sites More sharing options...
TheStalker Posted January 27, 2009 Share Posted January 27, 2009 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. Quote Link to comment Share on other sites More sharing options...
Ordillus86 Posted January 27, 2009 Author Share Posted January 27, 2009 You will be saving yourself time in the long run As long as it doesn't turn my remaining hair grey :-\ Quote Link to comment Share on other sites More sharing options...
Ordillus86 Posted January 27, 2009 Author Share Posted January 27, 2009 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 =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.