Bind to Grid
-
I wish to bind a jqGrid to the data in wp_db7_forms(table) and I am not sure how to break down the “form_value” field. I believe I am correct in saying your add-on inserts an array into the field value.
I know how to pull the data(records I want), however I am not sure how to move it into my grid’s binding array. Below is an example of code I use currently to bind another grid.$query = "SELECT beverages.ID, beverages.name, beverages.desc, beverages.price, beverages_catagory.catagory AS cat "; $query .= "FROM beverages "; $query .= "JOIN beverages_catagory "; $query .= "ON beverages_catagory.ID=beverages.catagory "; $query .= "WHERE beverages.active=0 "; $query .= "order by beverages.name"; $result = $mysqli->prepare($query); //$result->bind_param('ii', $from, $to); $result->execute(); /* bind result variables */ $result->bind_result($ID, $name, $desc, $price, $cat); /* fetch values */ while ($result->fetch()) { $customers[] = array( 'ID' => $ID, 'name' => $name, 'desc' => $desc, 'price' => $price, 'cat' => $cat ); } echo json_encode($customers);
This will probably demonstrate my lack of coding abilities, but if I am correct that the field value is already an array how do I use it to populate another array (the array that binds to the grid)?
Am I totally off base and there is a smarter way to achieve the grid binding?Thanks
- The topic ‘Bind to Grid’ is closed to new replies.