We do hope you all happen to be doing great...

I'm here right now to search for an response to my problem...

I produced a wordpress plugin and triggered it, it doesn't produce a table etc just simple php script.

<?php

/*
Plugin Name: F
Plugin URI: h
Description: T
Author: D
Author URI: h
*/

$server = "localhost";
$user = "admin";
$password = "";
$db = "wordpress";

$con = mysql_connect($server,$user,$password); 

if (!$con) {
    die("database connection error");
} else 

{

    mysql_select_db($db, $con);

    $results = mysql_query("SELECT ID, post_title FROM wp_posts "

    . "WHERE "

    . "post_status = 'publish' "
    );

    while($row = mysql_fetch_array($results))
    {
        echo $row['post_title'];
    }

}

the autocomplete code is really as below

    $("#imageSearch").autocomplete("<?php echo bloginfo('wpurl')."/wp-content/plugins/foxycomplete/"; ?>foxycomplete.php", {
dataType: "json",
    parse: function(data) {
        return $.map(data, function(row) {
            return {
            data: row,
            value: row.title,
            result: $("#imageSearch").val()
            }
        });
    }

}).result(function(e, item) {
    location.href = link(item);
    });
});

this really is working however i think that this isn't the proper way. I'm not able to utilize the wordpress functions may be the wordpress plugin script this also appears unsafe and vulnerable to hacking...

could anybody help the way i could possibly get a php file to give the autocomplete that may access wop functions and it is safe?

Thanks!

There is no such factor like a Wordpress plugin Page. The code above should most likely be covered with a function and known as from somewhere inside a WordPress context, or it ought to be utilized in an action or perhaps a filter.

If you're being able to access the wordpress plugin page directly instead of from inside Wordpress, the issue may be the $wpdb isn't being initialized. This really is completed in the WordPress header, that is normally incorporated around the page if you're within a Wordpress template. Try including wordpress-blog-header.php inside your script with something similar to this:

include_once(‘wp-blog-header.php’);