Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your script can't work. You are mixing PHP and HTML:</p> <pre><code>$count=mysql_num_rows($result); &lt;div class="commentbox"&gt; /*THIS IS WRONG*/ while($row=mysql_fetch_assoc($result)) </code></pre> <p>I think this is what you want:</p> <p>Create a new PHP file which only outputs your list. Call it, for example, <code>list.php</code>.</p> <p>Content of main file:</p> <pre><code>&lt;a class="click" href="#"&gt; Link TO refresh Div &lt;/a&gt; &lt;div class="messagelist"&gt; &lt;div class="commentbox"&gt; &lt;ul&gt; &lt;?PHP $result=mysql_query("select * from messages where id&lt;'$lastmsg' order by id desc limit 20"); $count=mysql_num_rows($result); while($row=mysql_fetch_assoc($result)) {?&gt; &lt;li&gt; &lt;?php echo $row['id'] . ' #' . $row['date'] . ' / ' . $row['comment']; ?&gt; &lt;/li&gt; &lt;?PHP } ?&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Content of <code>list.php</code>:</p> <pre><code>&lt;?PHP $result=mysql_query("select * from messages where id&lt;'$lastmsg' order by id desc limit 20"); $count=mysql_num_rows($result); while($row=mysql_fetch_assoc($result)) {?&gt; &lt;li&gt; &lt;?php echo $row['id'] . ' #' . $row['date'] . ' / ' . $row['comment']; ?&gt; &lt;/li&gt; &lt;?PHP } ?&gt; </code></pre> <p>Add this to the <code>&lt;head&gt;</code> part of the main file:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ $('.click').on('click', function(e){ e.preventDefault(); $('.messagelist').text('Please wait...'); $('.messagelist').load('list.php'); }); }); &lt;/script&gt; </code></pre> <p>to load the content.</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.
    2. 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