<?
if ($_POST['submit'] != "")
   {
$db = mysql_connect("localhost", "mmaaaco_ksecor", "hamilton");
mysql_select_db("mmaaaco_ksecor",$db);
$post = $_POST['search'];
echo "YOU searched for $post<br/>";
$result = mysql_query("select pk_tId,firstName,details from testTable where match(details) against('$post')",$db);
/*
echo 'There were '. mysql_num_rows($result).'(s) for '.$post; 
if (mysql_num_rows($result) < 1)
   {
$result = mysql_query("select pk_tId, firstName, details from testTable where  firstName like '%$post%'
 OR lastName like '%$post%'
 Or details like '%$post%'");  
   }
   */
?>
<table>
	<tr><td colspan="4"><a name="top"><h3>Student Practice Queries</h3></a>
</td>
	</tr>
	<tr>
	<th align="left">Name</th></tr>
 <? 
 // display list if there are records to display. The %s is a placeholder for each field you select below
 	if ($myrow = @mysql_fetch_array($result)) {

      do {
	  $id = $myrow[0];
       $details = $myrow[details];
	   $detailsarray =  explode(".",$details);
	   
	   echo  "$myrow[firstName] ".$detailsarray[0]. " ".$detailsarray[1]."<a href = \"moredetail.php?id=$id\">Read More</a><br/><br/>";

      } 
      while ($myrow = mysql_fetch_array($result));
  }
  ?>
  </table> 
  <?
  }

  ?>
  <form action = "search.php" method = "post">
  Search<br/>
  <input type = "text" name = "search" />  
  <input type = "submit" name = "submit" value = "search"/>
  </form> 
