Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter gweedo767

    (@gweedo767)

    I thought about doing that with the search box, but just haven’t done it yet. What you are talking about would be similiar to how Google Suggest shows its content.

    I will let you know if I add that.

    Thread Starter gweedo767

    (@gweedo767)

    They are all closed due to horible spamming at the moment. I plan to turn them back on with required registration. Any other recommendations?

    Forum: Plugins
    In reply to: New AJAX based search box
    Thread Starter gweedo767

    (@gweedo767)

    It should be safe, but you could optionally just have the script load the wp-config.php file like this:
    require( dirname(__FILE__) . ‘/wp-config.php’ );
    Then just use the variables it sets for your MySQL connection.

    Forum: Plugins
    In reply to: New AJAX based search box
    Thread Starter gweedo767

    (@gweedo767)

    Okay, I updated this post to have a text file with the needed code. You can get the code directly here.

    Enjoy!

    Let me know if you implement it. I am curious to see what people do with it.

    Also…I hope to compe up with some more AJAX based updates for WordPress soon.

    Forum: Plugins
    In reply to: New AJAX based search box
    Thread Starter gweedo767

    (@gweedo767)

    Wierd, that posting of search.php is wrong 🙂 Here is a correct version of it:

    <?php

    mysql_connect(“DBHOST”,”DBUSER,”DBPASS”);
    @mysql_select_db(“DATABASE”) or die(“Freaking db seems to have left”);

    //make sure that string isn’t in use
    $search = $_REQUEST[‘val’];
    $sql = “SELECT * FROM wp_posts WHERE post_title LIKE ‘%$search%’ OR post_content LIKE ‘%$search%'”;
    $result = mysql_query($sql);
    $num = mysql_numrows($result);
    mysql_close();

    $i=0;
    while($i<$num) {
    $id = mysql_result($result,$i,”ID”);
    $title = mysql_result($result,$i,”post_title”);
    ?>
    “><? echo $title ?>
    <?
    $i++;
    }
    if($num == 0) {
    ?>
    No Results on ‘<? echo $search ?>’
    <?
    }

    ?>

    END OF PHP

    Of course, be sure to replace things like HOST and DBUSER and what not with their correct values for you.

Viewing 5 replies - 1 through 5 (of 5 total)