ASPit - Totally ASP
 

Go Back   PHPit Forums > Community > TPG PHP Scripts > PHP:DataGrid
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 02-15-2006, 03:45 PM   #1
ken264usd
Junior Member
 
Join Date: Feb 2006
Posts: 6
Question Question about posting data back to database

Hello,
Does anyone know how I post my data from ($_DATAGRID->update['task_id']) and get the update information updated in my database table? Otherwords, I run this datagrid table, click edit, edit some fields, click update and the updated values show as expected but the values are not updating in the table itself. Any help would be greatly appreciated!
===============================================
CODE:

// Include PHPataGrid
include ('../../phpdatagrid/phpdatagrid.php');

// Connect to database
$link = mysql_connect (xxxx);

// Select database
mysql_select_db('prim_gradebook', $link);

// Do query and Get data
$result = mysql_query("SELECT tb_gradedata.grade_id, tb_gradedata.STULINK, tb_gradedata.LASTNAME, tb_gradedata.FIRSTNAME, tb_gradedata.classid, tb_gradedata.task_id, tb_gradedata.Q1, tb_gradedata.Q2, tb_gradedata.Q3, tb_gradedata.Q4 FROM tb_gradedata, tb_tasks WHERE tb_tasks.taskid = tb_gradedata.task_id");
$data = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{

array_push ($data, $row);

}

// Bind data (THIS IS IMPORTANT)
$_DATAGRID->bind ('test', $data);
//print_r($data)
?>


PHP<img src="images/smilies/biggrin.gif" border="0" alt="" title="Big Grin" class="inlineimg">ataGrid Demo 1



PHPataGrid Demo 1


Demonstrating a simple PHPataGrid, and nothing more.




if (DG_ACTION == 'update') {
echo "Updated Value's:

";
//echo "Grade ID: " . htmlentities($_DATAGRID->update['grade_id']) . "
";
//echo "Student ID: " . htmlentities($_DATAGRID->update['stulink']) . "
";
//echo "Last Name: " . htmlentities($_DATAGRID->update['lastname']) . "
";
//echo "First Name: " . htmlentities($_DATAGRID->update['firstname']) . "
";
//echo "ClassID: " . htmlentities($_DATAGRID->update['classid']) . "
";
echo "TaskID: " . htmlentities($_DATAGRID->update['task_id']) . "
";
echo "Quarter 1:" . htmlentities($_DATAGRID->update['q1']) . "
";
echo "Quarter 2:" . htmlentities($_DATAGRID->update['q2']) . "
";
echo "Quarter 3:" . htmlentities($_DATAGRID->update['q3']) . "
";
echo "Quarter 4:" . htmlentities($_DATAGRID->update['q4']) . "

";

}

//print_r($_DATAGRID)
?>