title: Ajax, PHP, MySQL retrieve data
body: <p>i'm trying to auto retrieve data from mysql server in specific DIV without manual refresh the web page.</p>
  
  <p>My PHP code is:</p>
  
  <pre><code>function lastCodes(){
      include('mysql.php');
      include('config.php');
  
  echo "&lt;div id='content_data'&gt;";
  
      $get = mysql_query("SELECT * FROM scripts ORDER by date_added DESC");
      if(mysql_num_rows($get)&gt;0){
          while($row = mysql_fetch_assoc($get)){
  
              $get2 = mysql_query("SELECT * FROM accounts WHERE username = '$row[s_owner]'");
                  while($red = mysql_fetch_assoc($get2)){
  
              echo "&lt;table&gt;
                          &lt;tr&gt;
                                  &lt;td width='22px'&gt;";
                          if(!empty($red['avatar'])){
                              echo "&lt;center&gt;
                                          &lt;img src='$red[avatar]' style='width: 52px; height: 52px; margin-left: -30px; border: 2px solid #fff;' title='$row[s_owner]'/&gt;
                                      &lt;/center&gt;
                                  &lt;/td&gt;";
                          } else {
                              echo "&lt;td width='22px'&gt;
                                          &lt;center&gt;
                                              &lt;img src='/theme/$tema/icons/empty_avatar.png' style='width: 52px; height: 52px;' title='$row[s_owner]'/&gt;
                                          &lt;/center&gt;
                                      &lt;/td&gt;";
                          }       
  
              echo "&lt;td&gt;
                          &lt;a style='font-family: IndexName; color: #000; font-size: 14px; margin-left: 5px;'&gt;&lt;b&gt;$row[s_owner]&lt;/b&gt; написа &lt;a title='$row[s_name], Категория: $row[s_category].' href='#' style='text-decoration: none;'&gt;нов код&lt;/a&gt; &lt;a style='font-family: IndexName; color: #000; font-size: 14px; margin-right: 10px;'&gt;в $row[date_added]&lt;/a&gt;
                      &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;/table&gt;";
  
          }
  
          }
  
      }
  
  echo "&lt;/div&gt;";
  
  }
  </code></pre>
  
  <p>What should be in my case the jquery/ajax code if I want to retrieve this information in DIV called "content_data" in interval of 5 seconds? Thanks a lot!</p>