I need two mysql query scripts like on these two sites

Discussion in 'PHP' started by jacobkell, Oct 13, 2007.

  1. #1
    They are both mysql query related,but i dont know exactly how to create such script.First example is on http://cheaterhell.com
    and other on http://adult-sponsor-search.com/
    As you can see,on first site you type keyword and get certain data about it.
    On second you select boxes and got results which match that boxes.
    Any suggestion?Somewhere must be such scripts beacuse it is nothing complicated,simple mysql query.
     
    jacobkell, Oct 13, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    It's a bit more than a "simple MySQL query"...

    The first:

    
    
    $keywords = explode("\n", $_POST['foo']);
    $keywords = array_splice($keywords, 50);
    $keywords = array_map('mysql_real_escape_string', $keywords);
    
    $query = mysql_query("
        SELECT *
        FROM table_name
        WHERE field_name
        IN('" . implode("', '", $keywords) . "')
    ") OR die(mysql_error());
    
    while ($result = mysql_fetch_array($query))
    {
        // Do whatever with $result
    }
    
    PHP:
    Second (similar)

    
    $categories = array_map('mysql_real_escape_string', (array)$_POST['category']);
    
    $query = mysql_query("
        SELECT *
        FROM table_name
        WHERE field_name
        IN('" . implode("', '", $categories) . "')
    ") OR die(mysql_error());
    
    while ($result = mysql_fetch_array($query))
    {
        // Do whatever with $result
    }
    
    PHP:

    These codes are just raw (untested) examples, as we don't have ANY of your database information or anything else related to what you want to do. But you might get the idea...
     
    nico_swd, Oct 13, 2007 IP
  3. jacobkell

    jacobkell Well-Known Member

    Messages:
    830
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #3
    I already know for that :( I need clone of this two examples.It must be script somewhere.
     
    jacobkell, Oct 13, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Lol, thanks for saying that in your first post. :rolleyes:

    I posted what you asked for...

    ......................................


    PLUS, the script doesn't consist in much more... but yeah.
     
    nico_swd, Oct 13, 2007 IP
  5. jacobkell

    jacobkell Well-Known Member

    Messages:
    830
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #5
    Ah yes indeed you posted answer.But what i can do with part of code?Script include two parts:html interface and second is php code which connect to mysql database and check queries.But still that is not enough :(
     
    jacobkell, Oct 13, 2007 IP
  6. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #6
    You didn't ask for the ENTIRE script initially. I posted what you asked for and you come back telling me you already know this?

    Not trying to sound harsh, but you know how to code the PHP part but can't do the HTML interface which consists in a simple form?


    I'm not gonna randomly post some code and guess any more. You will have to say EXACTLY what you want and what you have already. Do you even have a database? Do you have data? Do you know what kind of data you want to display?
     
    nico_swd, Oct 13, 2007 IP
  7. jacobkell

    jacobkell Well-Known Member

    Messages:
    830
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #7
    Yes i do have data.And yes i need a working script.
    So what i need a form,type a word inside,when i click check i need to see details about that word.Also it need to have option for multiple check.
     
    jacobkell, Oct 13, 2007 IP
  8. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #8
    For the first script.
    
    <form action="script.php" method="post">
    <textarea name="foo"></textarea>
    <input type="submit" value="Submit" />
    </form>
    
    HTML:

    And the second.

    
    <form action="script.php" method="post">
    foo <input type="checkbox" name="category[]" value="foo">
    bar <input type="checkbox" name="category[]" value="bar">
    foo2 <input type="checkbox" name="category[]" value="foo2">
    <input type="submit" value="Submit" />
    </form>
    
    HTML:

    That's all I can do since mind reading doesn't work over the internet.
     
    nico_swd, Oct 13, 2007 IP
  9. jacobkell

    jacobkell Well-Known Member

    Messages:
    830
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #9
    The thing is what i need is clone of sites which i given as example.
    I already founded script which is even better then example on second site.Name of script is dadabik.Now i only need to found script from first example.In any case,thanks for you effort.
     
    jacobkell, Oct 14, 2007 IP