| 1234567891011121314151617181920212223242526 |
- <?php
- session_start();
- include_once("requestDB.php");
- if(isset($_POST['message']))
- {
- $sql = "INSERT INTO `chat` (`fromuser`, `touser`, `content`, `sendtime`)
- VALUES ( '"
- .$_POST['fromuser']."','"
- .$_POST['touser']."','"
- .$_POST['message']
- . "',CURRENT_TIMESTAMP)";
- queryw($sql, "teabag");
- }
- $chatsql = "select * from chat where
- (touser='" . $_POST['fromuser'] . "' and fromuser='".$_POST['touser']."') or
- (touser='" . $_POST['touser'] . "' and fromuser='".$_POST['fromuser']."') ORDER BY sendtime";
- $chatdata = query($chatsql,"teabag");
- foreach ($chatdata as $chat){
- echo '<a>'.$chat['fromuser']."(".$chat['sendtime']."):</a><br/>".$chat['content']."<br/>";
- }
- ?>
|