<?php
include("includes/db.php");
$search_word=$_GET['q'];
$sql = mysql_query("SELECT msg_id FROM messages WHERE message LIKE '%search_word%'") or die(mysql_error());
$record_count=mysql_num_rows($sql);
//Display count.........
echo $record_count;
?>