Thread: Search function

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Search function


    What is wrong with this code? pls help me. This is to display the searching results in php. I was trying to add the results into a div class.


    echo "$count.)"
    echo "<div class="prod_box">" ;
    echo "<div class="center_prod_box">";
    echo "<div class="product_title">".$row['product name']."</div>"
    echo "<div class="product_img"><img src=".$row['image']." width="117" height="86" /></div>"
    echo "<div class="prod_price"><span class="price">".$row['image']."</span></div>"
    echo "</div>" ;
    echo "<div class="prod_details_tab"> <a class="prod_buy">Add to Cart</a> <a class="prod_details">Details</a> </div>" ;
    echo "</div>" ;

    $count++ ;
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Location
    Hyderabad
    Posts
    10
    Rep Power
    0

    Search function sample code


    The code given by you is wrong and it is not for searching the related items of keyword matches your search.

    The actual search function code is
    <form action="search.php" method="GET">
    <input type="text" name="search">
    <input type="submit" name="go" value="Search Website">
    </form>

    code written by you only displays particular information of a particular product, its cost, size, color and image of it.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,015
    Rep Power
    535
    You definitely need to learn about using strings and how to use quotes. Try the following two scripts and see if either work for you. What is different about them?
    PHP Code:
    <?php
    echo ("<div class="prod_box">Hello World</div>");
    ?>

    <?php
    echo ('<div class="prod_box">Hello World</div>');
    ?>
    The official documentation is located at http://php.net/manual/en/language.types.string.php. I don't know if it is any good, but a quick "php quotes" search came up with http://www.trans4mind.com/personal_d...ial/quotes.htm.

IMN logo majestic logo threadwatch logo seochat tools logo