Younger brother Beginners, ask a question, master help AH

Source: Internet
Author: User
Brother Rookie, ask a question, Master help AH!!!!!!
The little brother wants to do a click on the data in the table can be edited online. After editing, press ENTER to directly put the newly modified data into the storage!!

HTML code:














$sql = "SELECT * FROM News", $result =mysql_query ($sql), while ($rs =mysql_fetch_array ($result)) {?> }?>






jquery Code:

$ (function () {
var NUMTD = $ ("tr Td:even");
Numtd.click (function () {
var input=$ (" ");

Input.css ("Border-width", "0");


var tdobj=$ (this);
Input.width (Tdobj.width ());


Input.val (tdobj.html ());
Tdobj.html ("");
Input.appendto (Tdobj);
Input.get (0). Select ();
Input.click (function () {
return false;
});

Input.keyup (function (event) {
var keycode = Event.which;
var Inputtext = $ (this). Val ();

if (keycode = = 13) {
$.get ("http://127.0.0.1:8080//100/jquery/insert.php?name=" +inputtext);

}

if (KeyCode ==27)
{
tdobj.html (text);
}

});
});

});




PHP code

$name =$_get["id"];
$name =$_get["name"];
$title =$_get["title"]
$sql = "Update news set name= ' $name ' where id= ' $id '";

mysql_query ($sql);


Run the effect, click to edit. But the carriage return cannot be put into storage. Please master solution!!!! Thank you!!

------Solution--------------------
$name =$_get["id"]; Is this a typo or your intending?
I can ' t find the place where do you input your ID field,

$sql = "Update news set name= ' $name ' where id= ' $id '";
But request here somehow.
------Solution--------------------
$name =$_get["id"];//link does not have an ID
$name =$_get["name"];
$title =$_get["title"]//link does not have title
  • Related Article

    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.