Jump to content

Recommended Posts

I'm trying to implement TableKit with my table. It works fine, except I'm struggling to update it dynamically. When I edit a table, it changes, but when I reload the browser it reverts back to the original data. The updated code goes to this php code, where I think I need to have this page communicate with my database but I don't know?:

 

<?php
header('Content-Type: text/plain; charset=UTF-8');
echo $_POST['value'];

?>

 

Can anyone guide me how I would be able to allow the edited data go to my database?

 

Probably a stupid question.

 

Thanks for any help.

Link to comment
https://forums.phpfreaks.com/topic/130371-using-tablekit-dynamically/
Share on other sites

I guess the main problem is writing a php script that can handle an AJAX REQUEST.  Can't figure it out.  When I update a table cell using, that information needs to update in my database.  Here is the php page I'm working on to handle this:

 

<?php

header('Content-Type: text/plain; charset=UTF-8');

$id = $_REQUEST['id'];
$fifteen = $_REQUEST["fifteen"];
$fifteenl = $_REQUEST["fifteenl"];
$fifteend = $_REQUEST["fifteend"];

// Connect to DB

// Include connection to your database
$con = mysql_connect("localhost","","");
mysql_select_db("myrunningpb", $con) or die(mysql_error());

$query = "UPDATE myrunningpb SET fifteen = '$fifteen' WHERE id = '$id'";
$result = mysql_query($query) or die("Error");

echo $_POST['value'];
?>

 

This is terribly wrong, but I think on the right track.  Any suggestions would be greatly appreciated.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.