Editing the $sWhere w/Server Side getting no results on table?
Editing the $sWhere w/Server Side getting no results on table?
I've been working on this for a few days and i'm stuck.
I get 0 results on my table when the data is in the DB. I know its a problem with my $sWhere, but i cant see a problem. Someone help me please? $_SESSION['SESS_tech_id'] is VARCHAR by the way.
[code]
$that = $_SESSION['SESS_tech_id'];
$sWhere = "";
if ( $_GET['sSearch'] != "" )
{
$sWhere = "WHERE (";
for ( $i=0 ; $i
I get 0 results on my table when the data is in the DB. I know its a problem with my $sWhere, but i cant see a problem. Someone help me please? $_SESSION['SESS_tech_id'] is VARCHAR by the way.
[code]
$that = $_SESSION['SESS_tech_id'];
$sWhere = "";
if ( $_GET['sSearch'] != "" )
{
$sWhere = "WHERE (";
for ( $i=0 ; $i
This discussion has been closed.
Replies
and your database might require single quotes, not double, for it's query.
swap the quotes . change line 11 to
[code]
$sWhere .= " AND skid NOT LIKE '%rtv%' AND skid NOT LIKE '%scrap%' AND vendor = '$that' )";
[/code]
I'm thinking my problem is in line 13.
[code]
$sWhere .= ' AND skid NOT LIKE '%rtv
[/code]
that would treat % like modulus operator, not part of your string
to really see, check out the debugger for the response for that server call, or run the server call manually in a different browser window.
{"sEcho":3,"iTotalRecords":"0","iTotalDisplayRecords":"0","aaData":[]}
after you craft your main query, save a copy of it, then add to the object you return
[code]
$sQuery = "SELECT ".str_replace(" , ", " ", implode(", ", $aColumns))."
FROM $sTable
$sWhere
$sOrder
$sLimit
";
$sReturnQuery = $sQuery; // <--- new line
[/code]
then later return it
[code]
$output = array(
"sEcho" => $sEcho,
"iTotalRecords" => $iTotal,
"iTotalDisplayRecords" => $iFilteredTotal,
"sReturnQuery" => $sReturnQuery, // <--- new line
"aaData" => array()
);
[/code]
inspect the query to see if $_SESSION['SESS_tech_id'] is being read properly, for instance.
I'll try the return query.
Thanks for all the help.