Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The line: <code>$json['html'] = '&lt;p&gt;&lt;pre&gt;&lt;code&gt;id:'.$id.'.&lt;br&gt;Agency Name: '.$message[0].'&lt;br&gt;Account Number:'.$message[1]."&lt;br&gt;Phone:".$message[2].'&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;'.'&lt;br&gt;&lt;br&gt;test'</code>;</p> <p>only pulls one object from the result "$message[0]" the first elememt of the array. This is why you are only getting one object returned.</p> <p>edit: you'll need to change:</p> <pre><code>$message=array(); while ($row = mysql_fetch_assoc($result)) { $message[]= ('name' =&gt; $row['agency_name'], 'account' =&gt; $row['account_number'], 'phone' =&gt; $message[]=$row['phone'] ); } print json_encode($message); </code></pre> <p>This will then return a json object that you can parse with js</p> <p>then in your js:</p> <p>edit: then add your html in js if thats how you wanna do it</p> <pre><code>var html; $.each(data, function(info) { html += "&lt;p&gt;&lt;pre&gt;&lt;code&gt;id:"+ data_id +".&lt;br&gt;Agency Name: "+ info.name +"&lt;br&gt;Account Number:"+ info.number +"&lt;br&gt;Phone:"+ info.phone +"&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;br&gt;&lt;br&gt;"; }); $('.view_modal_content').html(html); </code></pre> <p>??????????????????????????????????????????????????????????????????</p> <p>are you trying to do:</p> <pre><code>var divObj = {}; //make sure this is in the correct scope //anonymous array $.each(data, function(info) { divObj.push("&lt;p&gt;&lt;pre&gt;&lt;code&gt;id:"+ data_id +".&lt;br&gt;Agency Name: "+ info.name +"&lt;br&gt;Account Number:"+ info.number +"&lt;br&gt;Phone:"+ info.phone +"&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;br&gt;&lt;br&gt;"); }); //or associative array $.each(data, function(info) { divObj[info.name] ="&lt;p&gt;&lt;pre&gt;&lt;code&gt;id:"+ data_id +".&lt;br&gt;Agency Name: "+ info.name +"&lt;br&gt;Account Number:"+ info.number +"&lt;br&gt;Phone:"+ info.phone +"&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;&lt;br&gt;&lt;br&gt;"; }); </code></pre> <p>or are you trying to simply update elements of an existing block of code in a div?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload