WEB开发网
开发学院WEB开发PHP 聊天室php&mysql(四) 阅读

聊天室php&mysql(四)

 2008-02-15 17:59:36 来源:WEB开发网   
核心提示:第四个页面 name="index.php" <? include "../signup/MySQL(和PHP搭配之最佳组合).php"; header("Expires: Sun, 28 Dec 1997 09:32:45 GMT"); header(
第四个页面 name="index.php"

<?
include "../signup/MySQL(和PHP搭配之最佳组合).php";
header("Expires: Sun, 28 Dec 1997 09:32:45 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: text/html; charset=${Charset}");

?>

<html>
<head>
<title>charmain</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Refresh" content="4; url=<? echo $PHP_SELF; ?>?userid=<?echo $userid?>">


</head>

<body bgcolor="#99CCFF" text="#000000">
<?  
  $max_row_length=30;  
  
  $select="select row from user_message order by row DESC";
    $result=MySQL(和PHP搭配之最佳组合)_query($select)or die(" false fgfg");
    $rowlist=MySQL(和PHP搭配之最佳组合)_fetch_array($result)or die("false");
    $max_row=$rowlist["row"];


  if($max_row>$max_row_length){
     
   
    $delete_row=$max_row-$max_row_length+1;

   // echo $max_row."<br>".$delete_row;
     $select="select row from user_message where row<".$delete_row;
    $result=MySQL(和PHP搭配之最佳组合)_query($select)or die(" false");
    while($row=MySQL(和PHP搭配之最佳组合)_fetch_array($result))
      {
         $sql="delete from user_message where row <".$delete_row;
   
         MySQL(和PHP搭配之最佳组合)_query($sql)or die ("del false1");
       }
     

      $left=$delete_row;
         }

  else {$left=1; 
     
     }

  for($i=$max_row; $i>=$left ;$i--)
  {
   $sql="SELECT message,userid,object,status,color,action1,time1 FROM user_message where row='$i'";
   $result=MySQL(和PHP搭配之最佳组合)_query($sql)or die(MySQL(和PHP搭配之最佳组合)_error());
   $row=MySQL(和PHP搭配之最佳组合)_fetch_array($result);
   $time1=$row["time1"];

   $usert1=$row["userid"];
   $objectt1=$row["object"];

1 2  下一页

Tags:聊天室 php mysql

编辑录入:coldstar [复制链接] [打 印]
赞助商链接