i've got a big Problem. I really like the layout of Flexigrid, but i
am not able to built my Table.
In the Example Source it says: url: post2.php.
I thought that this is the source where i echo the JSON. So i tried to
handle it this way:
This is my post2.php:
<?php
// Connect to MySQL database
mysql_connect('', $USER, $KEY);
mysql_select_db('database');
$page = 1; // The current page
$sortname = 'kundennummer'; // Sort column
$sortorder = 'ASC'; // Sort order
$qtype = ''; // Search column
$query = ''; // Search string
// Get posted data
if (isset($_POST['page'])) {
$page = mysql_real_escape_string($_POST['page']);
}
if (isset($_POST['sortname'])) {
$sortname = mysql_real_escape_string($_POST['sortname']);
}
if (isset($_POST['sortorder'])) {
$sortorder = mysql_real_escape_string($_POST['sortorder']);
}
if (isset($_POST['qtype'])) {
$qtype = mysql_real_escape_string($_POST['qtype']);
}
if (isset($_POST['query'])) {
$query = mysql_real_escape_string($_POST['query']);
}
if (isset($_POST['rp'])) {
$rp = mysql_real_escape_string($_POST['rp']);
}
// Setup sort and search SQL using posted data
$sortSql = "ORDER BY $sortname $sortorder";
$searchSql = ($qtype != '' && $query != '') ? "WHERE $qtype =
'$query'" : '';
// Get total count of records
$sql = "select count(*)
from dat_kunden
$searchSql";
First of all, try to isolate the problem, if it is in the server script or client script.
Try to execute manually the "post2.php" script (not via ajax, manually from the url line in your browser) and see the response in your screen. It's possible your are receiving a non well formed json in your client script
marcos
On 23 ene, 09:59, HummelHugo <hummelh...@googlemail.com> wrote:
> i've got a big Problem. I really like the layout of Flexigrid, but i > am not able to built my Table. > In the Example Source it says: url: post2.php.
> I thought that this is the source where i echo the JSON. So i tried to > handle it this way: > This is my post2.php: > <?php > // Connect to MySQL database > mysql_connect('', $USER, $KEY); > mysql_select_db('database'); > $page = 1; // The current page > $sortname = 'kundennummer'; // Sort column > $sortorder = 'ASC'; // Sort order > $qtype = ''; // Search column > $query = ''; // Search string > // Get posted data > if (isset($_POST['page'])) { > $page = mysql_real_escape_string($_POST['page']);}
> if (isset($_POST['sortname'])) { > $sortname = mysql_real_escape_string($_POST['sortname']);}
> if (isset($_POST['sortorder'])) { > $sortorder = mysql_real_escape_string($_POST['sortorder']);}
> if (isset($_POST['qtype'])) { > $qtype = mysql_real_escape_string($_POST['qtype']);}
> if (isset($_POST['query'])) { > $query = mysql_real_escape_string($_POST['query']);}
> if (isset($_POST['rp'])) { > $rp = mysql_real_escape_string($_POST['rp']);
> }
> // Setup sort and search SQL using posted data > $sortSql = "ORDER BY $sortname $sortorder"; > $searchSql = ($qtype != '' && $query != '') ? "WHERE $qtype = > '$query'" : ''; > // Get total count of records > $sql = "select count(*) > from dat_kunden > $searchSql";
By the way: You told the flexigrid script is in other directory, but... i guess you wrote the correct path, but i see you are calling jquery library in the same directory as php and html... is this correct ? Check all paths...
> First of all, try to isolate the problem, if it is in the server > script or client script.
> Try to execute manually the "post2.php" script (not via ajax, manually > from the url line in your browser) and see the response in your > screen. > It's possible your are receiving a non well formed json in your client > script
> marcos
> On 23 ene, 09:59, HummelHugo <hummelh...@googlemail.com> wrote:
> > Hi,
> > i've got a big Problem. I really like the layout of Flexigrid, but i > > am not able to built my Table. > > In the Example Source it says: url: post2.php.
> > I thought that this is the source where i echo the JSON. So i tried to > > handle it this way: > > This is my post2.php: > > <?php > > // Connect to MySQL database > > mysql_connect('', $USER, $KEY); > > mysql_select_db('database'); > > $page = 1; // The current page > > $sortname = 'kundennummer'; // Sort column > > $sortorder = 'ASC'; // Sort order > > $qtype = ''; // Search column > > $query = ''; // Search string > > // Get posted data > > if (isset($_POST['page'])) { > > $page = mysql_real_escape_string($_POST['page']);}
> > if (isset($_POST['sortname'])) { > > $sortname = mysql_real_escape_string($_POST['sortname']);}
> > if (isset($_POST['sortorder'])) { > > $sortorder = mysql_real_escape_string($_POST['sortorder']);}
> > if (isset($_POST['qtype'])) { > > $qtype = mysql_real_escape_string($_POST['qtype']);}
> > if (isset($_POST['query'])) { > > $query = mysql_real_escape_string($_POST['query']);}
> > if (isset($_POST['rp'])) { > > $rp = mysql_real_escape_string($_POST['rp']);
> > }
> > // Setup sort and search SQL using posted data > > $sortSql = "ORDER BY $sortname $sortorder"; > > $searchSql = ($qtype != '' && $query != '') ? "WHERE $qtype = > > '$query'" : ''; > > // Get total count of records > > $sql = "select count(*) > > from dat_kunden > > $searchSql";