0

I create auto complete but its source coming from javascript, now i want to get source from mysql database using php language.Below is my script, Please help me

<SCRIPT language="javascript">

$(document).ready(function() {

$("input#autocomplete").autocomplete({

source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]

});

});       

</SCRIPT>
2
  • input#autocomplete means you have id="autocomplete" somewher in your html and whenever you add new row if that row's id is also same as "autocomplete" then you will same error cause html should have unique ids per page. Commented Jan 31, 2012 at 6:32
  • 1
    you changed the question itself?? Commented Jan 31, 2012 at 6:36

2 Answers 2

1

Hope this helps, this is an example i made using php and mysql, you can download it from here:

http://dl.dropbox.com/u/15208254/trickylearning/examples/autocomplete/autocomplete-php.zip

Than main idea of this example is to have something with this structure in your db:

  • id: 1 / tag_column: jeans, jackets, shoes
  • id: 2 / tag_column: kfc, burger king, pizza hut

And the final result will split everything from db and look like this:

Final result of this example

Regards.

Sign up to request clarification or add additional context in comments.

1 Comment

No problem and don't forget to vote or check the answer as the correct one, if you don't understand something just tell me.
0

you can chage this <td width="249"><input type="text" name="name[]"/></td> to <td width="249"><input type="text" class="xyz" name="name[]"/></td> and in jquery use $(".xyz").autocomplete({});

3 Comments

thanks for ur response, i solve it now but now i change my question plz help me in this problem
Its so inconvenience, why could't you use new question, any how for current question what you are using in back end, or you want to use PHP to establish connection? and its not good idea to use db connectivity in UI, have separate Controller
at backend i use mysql database, & sorry for changing question bcuz i m new here & dont know much about this platform

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.