I am using the select2 plugin to populate tags from mysql. So I'm passing the q variable on getdada.php But the problem is that
-
q variable is not being sent to getdata.php. I want to pass this variable that I can get data related to it ( Maybe I'm not giving Q variable to the right place.)
2. If I do not use Q variable, then only the last or first variable is retrieved. I want to populate all the results in the form of tag data (probably there is an error in my jsoncode formate in getdata.php)
Plz help
$ 2 ("# e8") to execute the request to use the convenient helper url of Select2. Select2 ({Placeholder: "Search for another concept", minimum input length: 1, multiple: right, Ajax: {//} Return: function (data, page) {return {result: (for example, page) Information}; }}});
Here is getdata.php
$ sql = mysqli_query ($ db3, "select * o4_tags"); While ($ row = mysqli_fetch_array ($ sql)) {$ Tag = $ line ['tag_name']; $ Id = $ line ['id']; $ MyArray = array (array ("id" = & gt; "$ id", "text" => "$ tag"),); } Echo json_encode ($ myArray);
For a start, something is going wrong in your PHP script. You are currently retrieving a new $ myArray for each line. Only the last of these arrays is actually output as JSON. This code fixes the problem:
$ sql = mysqli_query ($ db3, "SELECT * FROM o4_tags"); $ MyArray = array (); While ($ row = mysqli_fetch_array ($ sql)) {$ Tag = $ line ['tag_name']; $ Id = $ line ['id']; $ MyArray [] = Array ("id" => "$ id", "text" = & gt; "$ tag"); } Echo json_encode ($ myArray);
I'm not sure why you do not see the search term in your PHP script, but again, I do not see any code in PHP which is actually a search term Works with Have you tried $ _REQUEST dumping?
No comments:
Post a Comment