简体   繁体   中英

using Another In Place Editor Jquery Plugin on mysql database

i am trying to insert data as a test for this JQuery plugin Jquery-in-place-editor , which doesn't work so far with me, here is what i did :

  1. i connected my server with mysql database, and to test the db functionality, i made a table called test with tow fields id which is PK and auto increment, and userUserName with datatype varchar .
  2. i pluged the jquery plugin as the instructions says and the script works perfectly for the css and editing

the problem is when i change any text , not thing happend on the server.

here is my code:

JQuery Plugin

 $(document).ready(function(){
        $("#editme1").editInPlace({
            url: "server.php",
            params: "name=david",
        });
    }); 

the name=david came with the script and it used on his demo test file, and because i am still rookie i do not know wether it affect my script or not.

Server.php (server-side file)

function Sqlconnection(){
$connection= mysql_pconnect("localhost","root","123") or die (mysql_error());
$db= mysql_select_db("reservebox",$connection) or die (mysql_error());
            }


Sqlconnection();

 $update = $_POST['update_value'];

$insert ="insert into test (userUserName) values ($update)";

mysql_query($insert) or die (mysql_error());

the $_POST['update_value'] should be the value that comes when i change the div editme1

div editme1

   <p id="editme1">
                    This example is with 
no options except for a callback 
that will handle the value when the edit is complete.
                </p>

can some explaing to me where do i go wrong here , i made sure the the jquery is attached and so the other required files , i used the demo file with script and it doesn't work also !

Did you add the library js file ?

<script type="text/javascript" src="../lib/jquery.editinplace.js"></script>

And you have an extra comma in your question, this can also break the plugin to load. Look at the comment line :

$(document).ready(function(){
    $("#editme1").editInPlace({
        url: "server.php",     //  you mentioned the file name as 'Server.php'
        params: "name=david", // this comma should not come here
    });
}); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM