2 Replies Latest reply: May 3, 2012 9:53 AM by sudarshan.t RSS

    Build a basic results page

    community help Community Member

      This question was posted in response to the following article: http://help.adobe.com/en_US/dreamweaver/cs/using/WScbb6b82af5544594822510a94ae8d65-78ada.h tml

        • 1. Re:  Build a basic results page
          Laurian Halverson

          I want to have a search field that the customer puts an item code in that will then lead them to an item that cannot be accessed otherwise.  I am new to Dreamweaver so I am a bit confused as to what would be the simplest way to complete this.  Then, on the Spry Slideshow widget how can you get your own pics into it?

          • 2. Re:  Build a basic results page
            sudarshan.t Community Member

            For Spry Slideshow Widget, this should help you: http://labs.adobe.com/technologies/spry/ui/docs/image_slideshow.htm

             

            For the item code thing, its a simple PHP search function where your script will execute a 'SELECT' MySQL query to figure out if the entered product code matches anything in your DB and it returns that item as a result. It'll be something like this. Your file should be saved as .php. Change 'localhost, username, password, dbname', according to your current setup. product_name is a column in your DB. Also, I'd highly recommend a set of books that's specifically written to cater to needs of people like you. I suggest you take a look at it. http://www.sitepoint.com/books/phpmysql5/

             

            Here's the code.

             

            mysql_connect('localhost', 'username', 'password');
            mysql_select_db
            ('dbname');

            $sql = "SELECT * FROM table WHERE product_name LIKE '%" . mysql_real_escape_string($_GET['search_query']) . "%'";

            $result = mysql_query($sql) or die("Error in query $sql: " . mysql_error());
            while ($row = mysql_fetch_array($result)) {
                echo
            "Product: " . $row['product_name'] . "<br />";
            }