Heres the breakdown
1. I have a list of products stored in a database - each product has it's own ID that auto increments.

  1. I'd like to be able to choose which product shows up on the home page as a featured product.

  2. I've already set it up to pull from the database. Just not sure how to specify the id for the index page since it's coming from a search engine and doesn't have a url id.

So it seems I need to be able to specify which id the home page gets so it knows which product to display.

Thanks

    After looking for a similar thread. I still didn't quite figure it out.

    I don't mind doing the work and looking for a solution. But could someone at least answer this?

    If I'm trying to specify an id on my index page to draw my data from, does it need to be a url I get the id from or can is there another way. Since they are coming from example a google page how could there be a url id....It seems there must be another way of doing this. Can you help a noob here?

    thanks

      quantumphp wrote:

      Heres the breakdown
      1. I have a list of products stored in a database - each product has it's own ID that auto increments.

      1. I'd like to be able to choose which product shows up on the home page as a featured product.

      2. I've already set it up to pull from the database. Just not sure how to specify the id for the index page since it's coming from a search engine and doesn't have a url id.

      So it seems I need to be able to specify which id the home page gets so it knows which product to display.

      Thanks

      I dont quite understand what is the problem.
      To get some data from your DB and put it on your homepage, can this be so difficult.
      If you have all data there, then it is just to use PHP to display your stuff.

      If there are images, I suppose you have a field in DB with name of image
      and a description of your product.

      Say you make a 'productview.php'
      Now at the page where search/request for a product with ID=77 is being made
      and pulled from DB, you can echo 1 or several links:

      <a href="productview.php?id=77">Productname</a>
      <a href="productview.php?id=78">Productname</a>

      In your productview.php one product is presented.
      For example id=77 data is SELECTED and all information, images and description displayed.
      Including and Using a special template: 'product_tpl.php'

        Thanks for the reply. That helps. I'm a noob so soaking up whatever little things I can .
        This will work for now. The point I'm stuck at is that with the list of products I have, I've created a control panel that lists those products. The idea was to add a feature to that control panel that says. "MAKE THIS THE FEATURED PRODUCT ON THE HOME PAGE"

        The idea was to have that single product displayed on the index.php page

        I've done a similar thing on other pages by passing the url id....I just don't know the code to do a similar thing on the index where there is no id in the url...

        I was under the impression that the GET command grabs the id from the url. Is there some other way that my index page can know what id the user has specified in their control panel. Is there a common convention for doing this or am I way off track?

        Thanks again,

          Okay I was going about this all wrong.

          INTENTION
          have a list of products being drawn from the database. Each product gets it's own id.
          Each product also gets a button that serves the function of making the product the main and featured product on the index.php page.

          CONFUSION
          I was trying to find a way to make the index.php know which product id to get based off that products is as it existed in that table.

          SOLUTION
          1. Create a new table called HOMEPAGE with a single id that the home page gets it's info from.
          2. Create an update form for the HOMEPAGE table where the id is specified and not taken from the url.
          3. Populate the form with content from my PRODUCT table which gets it's id from the url at this point in the form.

          ALL IN ALL
          The user can now click a button - it passes the product id via url to the homepage update form. The homepage update form then passes that information into the homepage table.

          I'm sure there is a better way of doing this but if it works it works.

            Write a Reply...