creating "live search" from database text field in Profile Content field Drupal 6
You're asking how to make an Ajax search request from a textfield.

I'm not going to answer your exact question but you need some javascript to fill in the results from your sql query into the search field. Here is an example which fills in an HTML &lt;options&gt; list from a Drupal sql search:

jQuery(function($) {

  $('#edit-field-survey-program-und option:gt(0)').remove();
  $('#edit-field-survey-program-und').attr('disabled', 'disabled');

  // When a country is selected. Find the Academic Programs within that
  // country from an SQL lookup. Then fill in the options values and
  // make that options list enabled for the site visitor.
  $("#edit-field-survey-country-und").click(function() {
    var selected_country = $("#edit-field-survey-country-und").val();
    if (selected_country != '_none') {
      // Do our SQL lookup from a service enpoint with a search parameter.
      $.ajax({
        type:'GET',
        url: '/eap-ajax/eap-country-programs/' + selected_country,
        data: '',
          success:function(data){
          // Replace values of target form element with found results.
          // Enable for enduser.
          $('#edit-field-survey-program-und option:gt(0)').remove();
          $.each(data, function(key, value) {
            $('#edit-field-survey-program-und').append(
              '&lt;option value="' + key + '"&gt;' + value + '&lt;/option&gt;'
            );
          });
          $('#edit-field-survey-program-und').removeAttr('disabled');
        }
      });
    }
  });
});


The above example is the same 3 pieces for any AJAX thing.


Make a click event listener function
Do your SQL business logic
Inject your results somewhere back into the page


For a full writeup feel free to see my more complete writeup:
http://blog.arvixe.com/drupal-ajax-autocomplete-dependant-form-elements-using-jquery/

I suggest googling how to fill in results to an &lt;input&gt; text field using jQuery.