<?php include("conn.php") ?>
<? 
$sql="select  *  from  joke ";
$result=mysql_query($sql);
$db_num=mysql_num_rows($result);
mysql_free_result($result);  

mt_srand((double)microtime()*1000000);
if ($db_num>1)
{
  $rand_num=rand(1,$db_num);
}
  else
{
  $rand_num=1;
} 

$nn=1;
$sql="select  *  from  joke ";
$rs=$conn->execute($sql);
while($nn<$rand_num)
{
  $nn=$nn+1;
  $rs->MoveNext();
} 
if (!$rs->EOF)
{
  $db_word=trim($rs->fields["word"]);
} 

$cc=$db_word;
if (trim($db_word)!='')
{
  print "1".$cc;
}
  else
{
  print "0";
} 
$rs->close;
$conn->close;

?>
	 
	
	 
	 
	 
