Coda
28-08-2008, 01:00 PM
Im using Scriptaculous' Ajax.InPlaceEditor and i have this :
<span id="status"> <?php echo $usrd[status]; ?> </span>
<script type="text/javascript">
<!--
new Ajax.InPlaceEditor('status', 'ajax.php');
-->
</script>But i dont no how to update the database in the ajax.php file i tried:
<?php
include("include/core.class.php");
//SQL QUERY
$dsql="UPDATE user SET status='".$usrd[status]."' WHERE id ='".$usrd[id]."'";
$dupdate=mysql_query($dsql) or die ("Couldn't Execute Command");
?>But it didnt update nothing, any ideas?
EDIT: nvm worked it out, apparently it automatically sends a post with the variable $value :D so i just done this
<?php
$value = $_POST['value'];
$dsql="UPDATE user SET status='".$value."' WHERE id ='".$usrd[id]."'";
$dupdate=mysql_query($dsql) or die ("Couldn't Execute Command");
echo $value;
?>
<span id="status"> <?php echo $usrd[status]; ?> </span>
<script type="text/javascript">
<!--
new Ajax.InPlaceEditor('status', 'ajax.php');
-->
</script>But i dont no how to update the database in the ajax.php file i tried:
<?php
include("include/core.class.php");
//SQL QUERY
$dsql="UPDATE user SET status='".$usrd[status]."' WHERE id ='".$usrd[id]."'";
$dupdate=mysql_query($dsql) or die ("Couldn't Execute Command");
?>But it didnt update nothing, any ideas?
EDIT: nvm worked it out, apparently it automatically sends a post with the variable $value :D so i just done this
<?php
$value = $_POST['value'];
$dsql="UPDATE user SET status='".$value."' WHERE id ='".$usrd[id]."'";
$dupdate=mysql_query($dsql) or die ("Couldn't Execute Command");
echo $value;
?>