Jump to content

Database result itemization ? Database Vs filing system?


Phpfanboi

Recommended Posts

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. ;)

 

 

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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.

Link to comment
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.