Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

SQL/PHP simple question.

Options
  • 20-03-2010 4:55pm
    #1
    Closed Accounts Posts: 649 ✭✭✭


    Howdy peoples,

    I am mid-way through creating my own site and have encountered one problem that I can't solve. I have a line in my PHP that is inserting values into my database. It works fine, everything is inserted grand, password encrypted - s'all good.

    The problem is, I want an individual page created for every value in the database, so that when the user enters a value, it is put into the database, and a page is made, with my stylesheet and layout for this value.

    I know there's a simple solution, I am just not on the ball today ! Can someone please help ?


Comments

  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Jeebus wrote: »
    Howdy peoples,

    I am mid-way through creating my own site and have encountered one problem that I can't solve. I have a line in my PHP that is inserting values into my database. It works fine, everything is inserted grand, password encrypted - s'all good.

    The problem is, I want an individual page created for every value in the database, so that when the user enters a value, it is put into the database, and a page is made, with my stylesheet and layout for this value.

    I know there's a simple solution, I am just not on the ball today ! Can someone please help ?
    I don't understand what you want. You need to be more specific.

    What's the value? - value can be anything.

    And when you create page? - why are you creating a page? - surely if you using database, you should be generating page dynamically.


  • Moderators Posts: 12,375 ✭✭✭✭Black_Knight


    Are you looking for something like how adverts.ie creates dynamic pages for each item thats uploaded?

    For example:
    http://www.adverts.ie/showproduct.php?product=200797

    showproduct.php is the page that shows all the adverts, but it needs its variable "product" to tell it what page to show.
    product=200797 is the products ID number.

    When you click on an ad on adverts.ie, it loads the a href page, showproduct.php?product=$productId (Im guessing) where $productId is taken from the database by your SQL statement. This productId would be similar to the "value" you speak of.
    This will then load up the showproduct.php page, with a the product variable included in the URL.

    Now in the showproduct.php page, im guessing you want every page to be unique, according to this "value" in your DB. So you need to take the productId from the URL. To do this use $someVariableName = $_GET; This takes whatever product is from the URL.

    Hope that helps, my first time helping someone with PHP so.... I could be poor at explaining it.


Advertisement