Note that there are some explanatory texts on larger screens.

plurals
  1. POarray push in php but ajax return undefined
    text
    copied!<p>im trying to push new value in my array using php</p> <pre><code>$select_all_schools = "SELECT * FROM schools "; $query = mysql_query($select_all_schools) OR die(mysql_error()); while($row = mysql_fetch_array($query)){ $item=array( 'school_name' =&gt; $row['school_name'], 'school_address' =&gt; $row['school_address'], 'school_id' =&gt; $row['school_id'], ); $select_sections = "SELECT * FROM section WHERE school_id = '".$row['school_id']."'"; $query_section = mysql_query($select_sections) or die(mysql_error()); $sections_counts = mysql_num_rows($query_section); $select_sections_deped_archive = "SELECT * FROM deped_grade_archive WHERE school_id = '".$row['school_id']."' GROUP BY section_id "; $query_section_deped_archive = mysql_query($select_sections_deped_archive) or die(mysql_error()); $sections_counts_grade_archive = mysql_num_rows($query_section_deped_archive); if($sections_counts_grade_archive == $sections_counts ){ $item['stat'] = 'Complete'; } else{ $item['stat'] ='Incomplete'; } } echo json_encode($item); </code></pre> <p>then get the values using ajax</p> <pre><code>function get_all_school_status(){ $.ajax({ type:'POST', url:'deped_functions.php', dataType:'json', data:{'func_num':'1'}, success:function (data){ $.each(data, function(i, item) { html = "&lt;tr&gt;"; html += "&lt;td style='width:20%;'&gt;&lt;input type='radio' name='school_id' value='"+data[i].school_id+"'&gt;&lt;/td&gt;"; html += "&lt;td style='width:25%;'&gt;&lt;label&gt;"+data[i].stat+"&lt;/label&gt;&lt;/td&gt;"; html += "&lt;td style='width:55%;'&gt;&lt;label &gt;"+data[i].school_name+"&lt;/label&gt;&lt;/td&gt;"; html += "&lt;/tr&gt;"; $('#table-schools-content').append(html); }); } }); } get_all_school_status(); </code></pre> <p>but unfortunately im getting undefined values though my console shows that i properly get the values from php to ajax. what wrong did i do?.. please help guys. tnx in advance</p>
 

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