Products website

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
losse
Forum Newbie
Posts: 6
Joined: Mon Dec 13, 2004 9:57 am

Products website

Post by losse »

Hi there
I need some direction. I want to launch a site about stamps. I recently inherited an expensive collection and want to sell it off since I have no desire to upkeep the collection. Instead of creating a table and updating it all the time, I want to post the stamps using some form of database technology. That way I only have to update the master "database" and make sure the files are on the server.

Could anyone point me to a language/software that would allow me to do this?

Thanks
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

PHP and MySQL would be perfect for this kind of project. PHP being the language you would write the page in and then MySQL as the database. This is a pretty standard sort fo request - maybe not with stamps, but with other items - so im sure you could find a pre-written solution at somewhere like hotscripts.com or by browsing this forum.
losse
Forum Newbie
Posts: 6
Joined: Mon Dec 13, 2004 9:57 am

Post by losse »

Thanks Kettle drum.
You'll have to excuse my ignorance as I am just putting my speedo on to dive into this new language... So, in terms of page structure and the "layout" of the page, PHP would dictate that and within the page, there would be MySQL requests to pull up all the different products (stamps).

So as I add or remove stamps, all I have to update is the database and I can lay off the php or web files?

I'll search hotscripts and see if I can find something.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Maybe worth looking into CMS and Online Shops: easy and out-of-the-box is something like Mambo ( http://www.mamboserver.com )
They have an eCommerce component called phpShop (needs seperate installation which is very simple): http://www.mambophpshop.com (I think)

Do note: if you want to ever modify the code of PHP Shop: you're in for a nightmare. From a developer's point of view it's a very, very unclean and buggy implementation and not worth the development time.
However, if you want a quick, out of the box solution, it should be something you might want to explore as it will work (i.e. sell things).
losse
Forum Newbie
Posts: 6
Joined: Mon Dec 13, 2004 9:57 am

Post by losse »

I took a look at some of the scripts I think they offer a lot more than what I am looking for. What I basically want to have is a table with say, 4 colums. In column 1 I would put the image of the stamp, column 2, the country, column three, the year and column 4 the price.

As I get more stamps, and as I sell these stamps, I would update a file that would expand/shrink that table according to the amount of records on the "datasheet"

Does that make sense? Should I clarify a little more?
losse
Forum Newbie
Posts: 6
Joined: Mon Dec 13, 2004 9:57 am

Post by losse »

hi gang
I figured out the answer to the previous post. It's just a matter of plugging into mysql and updating records.

Now my challenge is to figure out how to lay out the table on my website. So how do I table a table that's in a database and display it on a webpage?

Tahnks
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Something like:

Code: Select all

$result = mysql_query("SELECT * FROM table WHERE something = 'this'");
if(mysql_num_rows($result)){

echo "
   <table>
      <tr>
         <td>
            Col 1
         </td>
         <td>
            Col 2
         </td>
      </tr>
";

while($row = mysql_fetch_assoc($result)){
   echo "
      <tr>
         <td>
            {$row['field_1']}
         </td>
         <td>
            {$row['field_2']}
         </td>
      </tr>
   ";
}
echo "</table>";

}
Runs the sql query. Checks to see if there are any results. If there are it prints the table header with coloumn names. Then it loops through each result and prints them.
losse
Forum Newbie
Posts: 6
Joined: Mon Dec 13, 2004 9:57 am

Post by losse »

Thanks drum!!

So Col 1 and Cold 2 are the titles for the columns right?

And 'field_1' and 'field_2' is where the results of the table will populate? All I have to do is replace the name 'field_1' with the name of the column in my database?
Post Reply