SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Webpage Database

    I am building a site that will have multiple products. I want to build a database with product description, pics, price, etc. and be able to have a standard page that will pull from this database and fill in the standard page with the product content.

    My purpose is to have a formal database rather than hundreds of HTML pages. I have had success learning a little PHP and MySQL, but I'm not sure how to approach my specific need.

    It seems like I should have links to specific products and I could pass parameters to MySQL functions to pull from my database, but an href doesn't seem like it could pass arguments.

    Any thoughts?

    Thanks in advance!!

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by jrevard View Post
    ... but an href doesn't seem like it could pass arguments.
    sure it can

    for one example, look at the url for this thread

    the hrefs are identical for all threads in the forum database, except that each one contains the forum name, the forum number, a few words from the thread title, and the thread number -- those are all arguments
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh man that's great news! and thanks for the reply.

    So i tried it and here's where I'm at...i'm sure its got multiple problems. My hosting site (godaddy) freezes up when I try to upload the sample page I posted below.

    In this code the database.php file will use the "code" and "color" arguments to make decisions based on the database (this is not how it will be for real, but just an example i thought up). The site I found this method on was using javascript to pull the parameters, but I am using PHP. Does my database.php need specific tools/commands to pull the parameters?

    Code:
    <html>
    <head>
      <title>Products</title>
    </head>
    <body>
    <a href="database.php"?code=gun&color=silver>Silver Gun</a>
    <a href="database.php"?code=holster&color=tan>Tan Holster</a>
    </body>
    </html>

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by jrevard View Post
    Does my database.php need specific tools/commands to pull the parameters?
    i would imagine so

    unfortunately i can't help you, i do coldfusion, not php
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,400
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    Code:
    <a href="database.php"?code=gun&color=silver>Silver Gun</a>
    should be
    Code:
    <a href="database.php?code=gun&color=silver">Silver Gun</a>
    And for PHP questions, please see PHP - SitePoint Forums

  6. #6
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay guys, thanks for your help


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •