Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2006
    Location
    UK
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [SOLVED] xAJAX and PHP

    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
    PHP 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.
    Last edited by Linark; 12-23-2006 at 01:11 PM.
    - Mark

  • #2
    New Coder
    Join Date
    Nov 2006
    Location
    UK
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As a work around I have updated the function to:
    Code:
    	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
    - Mark

  • #3
    New Coder
    Join Date
    Nov 2006
    Location
    UK
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Problem solved!

    See here for solution
    - Mark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •