PHP Simple message This function implementation code

Source: Internet
Author: User
This article mainly for you in detail the PHP simple message This function of the implementation code, with a certain reference value, interested in small partners can refer to

This example for everyone to share the PHP message this function of the specific code for your reference, the specific content as follows

index.php

<?php error_reporting (0);                       Close notice hint require_once "conn.php";   $pagesize = 5; Each page shows 5 data $sql = "SELECT count (*) from guestlist";  Select the database, calculate the number of rows that match the criteria, and return the number of rows $result = mysql_query ($sql);  execution, if successful, returns the result set (all data is found from the database, the number of bars returned) $row = Mysql_fetch_row ($result); Get the array array[0]= "total number of bars in the database" $infoCount = $row [0]; Get total number of bars: Gets the value in the array $row[0]= "total number of bars in the database" $pageCount = Ceil ($infoCount/$pagesize); Get total Pages (total number/page number 5) $currpage =empty ($_get["page"])? 1:$_get["Page"];  If the current page is empty, the definition page=1 is $currpage=1 and vice versa if ($currpage > $pageCount)//If the number of pages entered exceeds the total number of pages, the default jumps to the last page {$currpage = $pageCount; }? ><! DOCTYPE html>

conn.php

<?php$link = mysql_connect ("localhost", "root", "" "), mysql_select_db (" Guestbook "); mysql_query (" Set names Utf-8 "); if (! $link) {die ("Connection failed:". Mysqli_connect_error ());} echo "link succeeded";?>

result.php

<?php error_reporting (0);    Close notice hint require_once "conn.php"; $title = $_request[' title ']; $username = $_request[' username '); $content = $_request[' content ']; $content = Str_replace ("\ n", "<br>", Str_replace ("", "", $content));    Show ' spaces ' and ' enter ' $week = ' Week '. Mb_substr ("Day 123456", Date ("W"), 1, "utf-8"); $isok =mysql_query ("INSERT into guestlist (title,username,content,addtime) VALUES (' $title ', ' $username ', ' $content ', ' ". Date (" Y-m-d h:i:s ")." $week ') ");  if ($isok)  {    echo "<script>      alert (' Submit success ');     location.href= ' index.php ';     </script> ";   } else {    echo ' <script>      alert (' Submit failed ');     location.href= ' index.php ';     </script> ";  } ?>

Css/index.css

body{margin:0;padding:0;} ul,li{list-style:none;margin:0;padding:0;} A{text-decoration:none;}. content{width:800px;  margin:0 Auto; }.bt{width:799px; height:20px; text-align:center; background: #EB9316; margin:0 0 5px 0;}. bt>li{float:left; width:265px; height:20px; text-align:center; line-height:20px; font-size:13px;}.          nr{Float:left; /* If not floating behind the LYNR will be affected */width:799px; height:20px; Text-align:center; Background: #B9DEF0;}. nr>li{float:left; width:265px; height:20px; text-align:center; line-height:20px; font-size:13px;}. lynr{Float:left;    /* If you do not float the layout will be messy */width:800px; margin:1px 0 1px 0; }.content p{width:70px; height:50px; float:left;  }. Content span{Display:block; width:710px; float:left;  } td{width:80px; padding:5px 0;/*border:1px solid #79ABFE; * *}TD input,textarea{border:1px solid #79ABFE;}       /*tr{Display:block; /* Set the TR to block element and then surround it with a chunk. Not a rectangle  }*/

Dist/css/bootstrap.min.css (Download yourself)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.