Modify Array to Output in JSON using PHP and jQuery -


I am currently working with it.

They are the code provided in the display:

   
"peter@pan.de", "Molly" => "molly@yahoo.com",); $ Result = array (); Foreign currency ($ item as $ key) {if (stropo (stroller ($ key), $ q)! == incorrect) {array_push ($ result, array ("name" => gt; $ key)); }} Echo json_encode ($ result); ? & Gt;

I would like to know how I can get my code out of my MySQL database.

I have tried my revision, but I am not doing it correctly, this is what I am trying to do:

  $ q = strtolower ( $ _ GET ["q"]); $ Sql ​​= "name select from user_info"; Required ("connection.php"); $ Result = mysql_db_query ($ DBname, $ sql, $ link) or die (mysql_error ()); $ Rows = array (); While ($ r = mysql_fetch_assoc ($ result)) {$ rows [] = $ r; Foreign currency ($ key as $ $) {if (stropo (stroller ($ key), $ q)! == wrong) {array_push ($ result, array ($ key)); }}} Print json_encode ($ rows);  

And this is my jQuery / JavaScript:

  $ ("# email"). Autocomplete ('emails.php', {multiple: incorrect, data type: "json", pars: function (data) {return $ .map (data, function (line) {return: {data: line, value: line (Name, result: line.name}};}, formatItem: function (item) {return format (item);}}) results (function (e, item) {$ ("# content"). Append (" & Lt; p & gt; Selected "+ Format (Item) +" & lt; / P & gt; ");}); }); As a result, Firebug shows that it throws the following error:  
  the value is undefined  

any help Thanks for getting my query setup properly enough will be highly unscripted!

I think this happens because you use an array converted in JSN You need to use an array as jquery result or you can do JSON string without the use of JSON: '[["" name ":" zone "," year ": 2009}, {" Name ":" tom "," year ": 2000}, ..] '.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -