PHP with jquery implementation of adding and deleting operations specific examples

Source: Internet
Author: User
Tags character set php foreach

  This article mainly introduces the PHP with jquery implementation and deletion of specific examples, the need for friends can refer to the

Background using PHP, the front desk reference jquery, to implement additions and deletions operation, code as follows:     code as follows: <script type= "Text/javascript" src= "Jquery-1.10.2.min.js" > </script>  <?php  Header ("content-type:text/html; Charset=utf-8 "); //mysql_connect Establish a connection, mysql_close ($link) Close the Non-persistent connection, Mysql_pconnect establish a permanent connection  //MYSQL_ Error returns the MySQL function wrong message, Mysql_errno returns the MySQL function error number  //mysql_set_charset sets the client character set, mysql_select_db chooses the connection database  // Mysql_query executes the query, Mysql_num_rows returns the query record number  //mysql_affected_rows returns the number of affected records, Mysql_free_result releases the result set memory  // Mysql_fetch_row returns an enumeration of array records, MYSQL_FETCH_ASSOC returns associated array records  //mysql_fetch_array returns associated array or digital array records, Mysql_fetch_object Returns the object form record  //mysql_fetch_result Obtain the result fundraising  //%s string,%c an ASCII character,%d an integer,%u a symbol number,%x a hexadecimal number   mysql_query (" Set Charaset set Utf-8 ");  $message =@$_post[" message "];  $shanchu =@$_post[" Shanchu "];  $top _title=" PHP Basic Exercise ";  $con =mysql_connect (" localhost "," root "," "); //Connection Database   Mysql_set_charset (' Utf-8 ', $con);   mysql_select_db ("Dbl", $con); ///define Database command query   $sql = "SELECT ' Message ', ' time ', ' ID ' from message ORDER by id desc limit 0,30"; //execution number According to the library query   $rs =mysql_query ($sql, $con);  $time =date (' y-m-d h:i:s ', Time ()); //Get the number of bars     $num _rows= Mysql_num_rows ($RS);//mysql_num_rows returns the query record bar number   if (Isset ($_post["submits")) {  if (!$_post["message"]== NULL) {  $queryinsert =sprintf (INSERT into message (Message,time) values ('%s ', '%s ') ',  $_post[' message '],$ Time);  mysql_query ($queryinsert, $con); }      if ($_post["message"]==null) {  echo ""; nbsp }  header ("location:http://localhost/table.php"); }    if (Isset ($_get["CLEARTD"]) && Intval ($_get[' CLEARTD ')) {  $querydelete = "Delete from message where id=". $_get[' CLEARTD '];      mysql_query ($querydelete, $con);  header ("location:http://localhost/table.php");    } ?>    <form method= "POST" action= "table.php" >  <tExtarea  name= "message" id= "message" ></textarea>  <input type= "Submit" Name= "submits" >   </form>    <ul>  <?php while ($row =mysql_fetch_array ($rs, MYSQL_ASSOC))   {  ?>  <li>  <?php foreach ($row as $tiao) {  echo $tiao; }?>      &L T;a name= "CLEARTD" href= "? cleartd=<?php echo $row [' id '];? > "> Delete </a>  </li>        <?php}?>  </ul>    

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.