Phpfanboi Posted August 26, 2010 Share Posted August 26, 2010 hello everyone, I am about to start coding my pages to display results from a database but before i do i want to know information about the following : Is it best to upload images to a database?and display them accordingly? or is it best to use images from a directory? What is most commonly used and or more reliable? Another topic i have trouble finding information on is actually positioning the output from you mysql database, is this practice done with tables?fields and rows? What is this method called? And is there more then one way to go about controlling result layout on your page? Sorry about the 1001 questions , but i am unable to find a clear answer on the topic ..especially question two . Thanks in advance. Quote Link to comment Share on other sites More sharing options...
litebearer Posted August 26, 2010 Share Posted August 26, 2010 Personal preference is to store image name in database, while the actual image is in a folder. As to displaying, keep in mind final output is client/browser side, sooo I usually start with what, where and how I want things displayed then work backwards to have php 'insert/echo' the 'data'. In other words - do the layout in html (using divs/tables/etc) and THEN start replacing with php. Make sense? Quote Link to comment Share on other sites More sharing options...
Phpfanboi Posted August 26, 2010 Author Share Posted August 26, 2010 Personal preference is to store image name in database, while the actual image is in a folder. As to displaying, keep in mind final output is client/browser side, sooo I usually start with what, where and how I want things displayed then work backwards to have php 'insert/echo' the 'data'. In other words - do the layout in html (using divs/tables/etc) and THEN start replacing with php. Make sense? Ok so i do the skeleton outlay of my page , with html & css as per standard , and then use php to fill in where i specify , for example within a table cell or within a Css div, and that should give me control over where my results land on my page? If this is correct please also tell me the name for this operation , thank you. Quote Link to comment Share on other sites More sharing options...
litebearer Posted August 26, 2010 Share Posted August 26, 2010 You are correct. As to a specific name, not sure it really has one. 'Design/coding/psuedo code/ect'??? simple example showing 3 pictures in a row as html... <table> <tr> <td><IMG SRC="/images/pic1.jpg"></td> <td><IMG SRC="/images/pic2.jpg"></td> <td><IMG SRC="/images/pic3.jpg"></td> </tr> </table> using php <table> <tr> <?PHP $picture_array[0] = "/images/pic1.jpg"; // you would actually get this info from the db table $picture_array[1] = "/images/pic2.jpg"; $picture_array[2] = "/images/pic3.jpg"; $i=0; while($i<3) { echo "<td>" . $picture_array[$i] . "</td>"; $i ++; } ?> </tr> </table> Quote Link to comment Share on other sites More sharing options...
Phpfanboi Posted August 26, 2010 Author Share Posted August 26, 2010 You are correct. As to a specific name, not sure it really has one. 'Design/coding/psuedo code/ect'??? simple example showing 3 pictures in a row as html... <table> <tr> <td><IMG SRC="/images/pic1.jpg"></td> <td><IMG SRC="/images/pic2.jpg"></td> <td><IMG SRC="/images/pic3.jpg"></td> </tr> </table> using php <table> <tr> <?PHP $picture_array[0] = "/images/pic1.jpg"; // you would actually get this info from the db table $picture_array[1] = "/images/pic2.jpg"; $picture_array[2] = "/images/pic3.jpg"; $i=0; while($i<3) { echo "<td>" . $picture_array[$i] . "</td>"; $i ++; } ?> </tr> </table> Thankyou very much just made my world so much clearer , very fine example .I like the possibilty also of replacing th <tr> and using a css div, to me it's just so much more versatile.And the image structure looks good too, thank you again take care. 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.