...

View Full Version : [SOLVED] xAJAX and PHP



Linark
12-22-2006, 10:38 PM
This is my first post for help, so please be nice to me...

I am using xAJAX for my ajax library.

I have this code
function generateClientList($fn, $sn) {

global $DB, $FUNC, $xAJAX;

$query_extra = array( 'fn' => $fn,
'sn' => $sn );

$DB->exec_cached_query("xajaxEditClientSearch", $query_extra);

$tag = "test";

$html = "Data submitted via xAJAX: $fn / $sn (" . $DB->fetch_num_rows() . ")";

$objResponse = new xajaxResponse();
$objResponse->Assign($tag, "innerHTML", $html);

return $objResponse;

}

The problem with it is that it will return a empty result as positive if you submit the query to the database even though there is no user with those details.

Linark
12-22-2006, 10:44 PM
As a work around I have updated the function to:
function generateClientList($fn="", $sn="") {

global $DB, $FUNC, $xAJAX;

$tag = "test";
$results = "0";

if( ( $fn != "" ) || ( $sn != "" ) ) {

$query_extra = array( 'fn' => $fn,
'sn' => $sn );

$DB->exec_cached_query("xajaxEditClientSearch", $query_extra);

$results = $DB->fetch_num_rows();

}

$html = "Data submitted via xAJAX: $fn / $sn (" . $results . ")";

$objResponse = new xajaxResponse();
$objResponse->Assign($tag, "innerHTML", $html);

return $objResponse;

}


Is there a better way of doing this?

Thanks in advance for any help received.

Merry Christmas

Linark
12-23-2006, 02:10 PM
Problem solved!

See here (http://www.codingforums.com/showthread.php?p=516991) for solution



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum