I am using jqGrid to support a database in MySQL using jSON data. I can display data in a grid, but when I try to add or edit a data row through a modal form, I get a message saying "Url is not installed." But what, apparently, should editurl contain? Mysql insert entries? I use the predefined grid adding and editing functions.
Also, if you look at the demonstration of the trirand page under Manipulation then in Grid Data. Do they indicate their url as url: 'server.php? Q = 2 'and their editurl: "someurl.php" They never say what someurl.php contains. Here I get lost and I cannot find a resource to give me any hints as to what should be in the editurl php file.
Thanks for any advice.
UPDATE:
Code in my editurl php file: I put the POST values from the col model in variables. I only need to insert and update statements in the switch statement. Take a look at my insert statement to find out which one I should use. I must also tell you that I do not list all the columns in the database, but I list all the columns that the user sees in the grid. The first insert statement is commented out, and it tells the columns that the values should be inserted in their order. The second insert statement executes the order that is in the database. Where you see "" are the columns that I did not want to display in the data grid for viewing by the user, because this information was not relevant.
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "**********";
$dbname = "codes";
// connect to the database
$mysql_connect($dbhost, $dbuser, $dbpass) or die("Connection Error: " . mysql_error());
mysql_select_db($dbname) or die("Error conecting to db.");
$div = $_POST['div_id'];
$l2 = $_POST['l2_id'];
$l1l2 = $_POST['l1l2_id'];
$l1l3 = $_POST['l1l3_id'];
$l2l3 = $_POST['l2l3_id'];
$beg = $_POST['exec_beg'];
$end = $_POST['exec_end'];
$csa = $_POST['csa_id'];
$area = $_POST['area_id'];
$areadesc = $_POST['area_desc'];
$shortdesc = $_POST['short_desc'];
$longdesc = $_POST['long_desc'];
$enabled = $_POST['avail_ind'];
switch($_POST['oper'])
{
case "add":
$query = "INSERT INTO divcodes values ($div,'',$l1l2,$l2,$l1l3,$l2l3,$beg,$end,'',''$csa,$area,$areadesc,$shortdesc,$longdesc,$enabled,'','','','','',''";
$run = mysql_query($query);
break;
case "edit":
//do mysql update statement here
break;
}
editurl php , , 500. , , 500 - .
, , (/), , insert update , , ?
UPDATE TAKE 2: , mysqli. , " 500". , , , , , . , (, ). phpmyadmin, . , , 500, .
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "**********";
$dbname = "codes";
// connect to the database
$conn = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Connection Error: " . mysql_error());
mysqli_select_db($conn,$dbname) or die("Error conecting to db.");
$div = $_POST['div_id'];
$l2 = $_POST['l2_id'];
$l1l2 = $_POST['l1l2_id'];
$l1l3 = $_POST['l1l3_id'];
$l2l3 = $_POST['l2l3_id'];
$beg = $_POST['exec_beg'];
$end = $_POST['exec_end'];
$csa = $_POST['csa_id'];
$area = $_POST['area_id'];
$areadesc = $_POST['area_desc'];
$shortdesc = $_POST['short_desc'];
$longdesc = $_POST['long_desc'];
$enabled = $_POST['avail_ind'];
switch($_POST['oper'])
{
case "add":
$query = "INSERT INTO divcodes (div_id,l1l2_id,l2_id,l1l3_id,l2l3_id,exec_beg,exec_end,csa_id,area_id,area_desc,short_desc,long_desc,avail_ind) values ($div,$l1l2,$l2,$l1l3,$l2l3,$beg,$end,$csa,$area,$areadesc,$shortdesc,$longdesc,$enabled)";
mysqli_query($conn,$query);
break;
case "edit":
$query = "UPDATE divcodes SET div_id=$div,l1l2_id=$l2,l2_id=$l1l2,l1l3_id=$l2l3,l2l3_id=$l2l3,exec_beg=$beg,exec_end=$end,csa_id=$csa,area_id=$area,area_desc=$areadesc,short_desc=$shortdesc,long_desc=$longdesc,avail_ind=$enabled";
mysqli_query($conn,$query);
break;
}
?>