Using a Form to Search Site. Why Doesn't My Form Work?

Discussion in 'PHP' started by Masterful, Sep 8, 2008.

  1. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #21
    OK, guys. I finally done it! YES! :D

    Well . . . Actually, someone else from Webmasterworld done it for me! :eek:

    Whatever the case, here's the code:

    <?php
    
    $search = $_POST["search"];
    
    $con = mysql_connect("localhost","root","") or die('cant connect: '.mysql_error());
    
    mysql_select_db("ctyi", $con);
    
    $sql = "SELECT advertiser_name from Advertiser_Table WHERE advertiser_name LIKE '%$search%'";
    
    $result = mysql_query($sql) or die('cant select: '.mysql_error());
    
    if(mysql_num_rows($result)) 
    
    {
    while($row = mysql_fetch_assoc($result) )
    {
    
    echo $row['advertiser_name'] . "<br />";
    }
    } // EndIf show match(es)
    
    else 
    {
    echo "Sorry! No matches found";
    } // EndElse no matches
    
    ?> 
    PHP:
     
    Masterful, Sep 9, 2008 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #22
    hi. yes i am busy, but i have a lot of work on. if you want me to complete work it will cost $110USD, let me know. asap. Jay
     
    JAY6390, Sep 9, 2008 IP
  3. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #23
    Huh?! :confused:

    Who are you responding to, dude? Was that meant to be a private message to someone?
     
    Masterful, Sep 9, 2008 IP