JqxGrid Server Side Editing / Update using PHP and MySQL (columntype:dropdownlist + using createeditor): Difference between revisions
Jump to navigation
Jump to search
Kaplanerkan (talk | contribs) |
Kaplanerkan (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
== My MySQL Sturucture == | |||
<pre> | |||
CREATE TABLE `waren_gruppen` ( | |||
`Firma` INT(3) NOT NULL, | |||
`Text` VARCHAR(50) NULL DEFAULT NULL, | |||
`Farbe` INT(2) NULL DEFAULT '0', | |||
PRIMARY KEY (`Firma`) | |||
) | |||
COLLATE='utf8_general_ci' | |||
ENGINE=InnoDB | |||
ROW_FORMAT=COMPACT; | |||
My target app is, that the customer must choose and define your color (farbe) yourself | |||
and save automatically the new values in mysql-tables. | |||
</pre> | |||
== PHP File Settings == | == PHP File Settings == | ||
<pre> | <pre> |
Revision as of 00:51, 26 December 2014
My MySQL Sturucture
CREATE TABLE `waren_gruppen` ( `Firma` INT(3) NOT NULL, `Text` VARCHAR(50) NULL DEFAULT NULL, `Farbe` INT(2) NULL DEFAULT '0', PRIMARY KEY (`Firma`) ) COLLATE='utf8_general_ci' ENGINE=InnoDB ROW_FORMAT=COMPACT; My target app is, that the customer must choose and define your color (farbe) yourself and save automatically the new values in mysql-tables.
PHP File Settings
<?php header('Access-Control-Allow-Origin: *'); $host = "localhost"; $databasename = "kasse_sql"; $username ="root"; $password = "MY_MYSQL_PASSWORT"; // If You want, you can send PASS, QUERY as POST and parser later here in this php // $x = $_GET['t']; // $tmp = explode(";",$x); // $password = $tmp[0]; // $query = $tmp[1] ; // $filename = $tmp[2]; $con = mysql_connect($host,$username,$password) or die(mysql_error()); mysql_query('SET CHARACTER SET utf8'); mysql_select_db($databasename) or die(mysql_error()); $query = "Select Firma, Text from waren_gruppen;"; if (isset($_GET['update'])) { // UPDATE COMMAND in my MySQL // UPDATE `waren_gruppen` SET Text ="Deneme" where firma = 11 $update_query = "UPDATE kasse_sql.waren_gruppen SET waren_gruppen.Firma='".$_GET['Firma']."', waren_gruppen.Text='".$_GET['Text']."' WHERE waren_gruppen.Firma='".$_GET['Firma']."'"; $result = mysql_query($update_query) or die("SQL Error 1: " . mysql_error()); echo $result; } else { // SELECT COMMAND $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $employees[] = array( 'Firma' => $row['Firma'], 'Text' => $row['Text'] ); } echo json_encode($employees); }