It is currently Fri Jul 30, 2010 2:02 pm


All times are UTC [ DST ]


Ask on Codemiles community and get answers Free and Fast :

Great articles about PHP scripting .If your a PHP beginner or advanced , you will find a helpful information here.

Our guest share with us your code snippets , your programming problems , your open source projects ,read articles and post yours .







Post new topic Reply to topic  [ 1 post ] 
  Print view Previous topic | Next topic 
Author Message
 Post subject: PHP example for a class
PostPosted: Mon Aug 17, 2009 1:10 pm 
Offline
Newbie
User avatar

Joined: Fri Jun 26, 2009 5:50 am
Posts: 23
Has thanked: 0 time
Have thanks: 0 time

This is example for class inheritance in PHP .


Code:
class MSSoapClient extends SoapClient {
    private 
$namespace;
    function 
__doRequest($request$location$action$version) {
        

        
$request preg_replace('/<ns1:(\w+)/''<$1 xmlns="'.$this->namespace.'"'$request1);
        
$request preg_replace('/<ns1:(\w+)/''<$1'$request);
        
$request str_replace(array('/ns1:''xmlns:ns1="'.$this->namespace.'"'), array('/'''), $request);
        
        
// parent call
        
return parent::__doRequest($request$location$action$version);
    }
    function 
setNamespace($sNamespace)
    {
        
$this->namespace=$sNamespace;
    }
    
}  
 


To make a new customer - I'm only you can extend the function to add other details to the record.
Code:
function newKashflowCustomer($soapClient,$idAccount,$name,$address,$town,$postcode,$country,$email)
{
    
//returns customer id if ok else 0
    
    
$today date("Y-m-d",mktime());
    
    
$customerArray = array(
        
"CustomerID"=>"",
        
"Code"=>"",
        
"Name"=>"$name",
        
"Contact"=>"",
        
"Telephone"=>"",
        
"Mobile"=>"",
        
"Fax"=>"",
        
"Email"=>"$email",
        
"Address1"=>"$address",
        
"Address2"=>"",
        
"Address3"=>"$town",
        
"Address4"=>"$country",
        
"Postcode"=>"$postcode",
        
"Website"=>"",
        
"EC"=>"0",
        
"Notes"=>"",
        
"Source"=>"",
        
"Discount"=>"0",
        
"ShowDiscount"=>"0",
        
"PaymentTerms"=>"0",
        
"ExtraText1"=>"1",
        
"ExtraText2"=>"1",
        
"CheckBox1"=>"1",
        
"CheckBox2"=>"1",
        
"Created"=>"$today",
        
"Updated"=>"$today");
    
    
$args = array ("UserName"=>"your username here""Password"=>"your password here","custr"=>$customerArray);
    
$oResponse $soapClient->InsertCustomer($args);
    
//handle any errors
    
if($oResponse->Status != "OK")
    {
        echo 
$oResponse->StatusDetail;
        
$return 0;

    }
    else
    {
        
$id $oResponse->InsertCustomerResult;
        
        
$return $id;
        
    }
    return 
$return;


_________________
Thanks & regards
Lokananth
[url "http://www.mioot.com"]Live Chat Software[/url] By miOOt


TOP
 Profile Send private message  
 
| More
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


 Similar topics
 Topic title   Forum   Author   Replies 
 create a named query within entity class  JPA  msi_333  0
 @EntityListeners in your entity class  JPA  msi_333  0
 JPA entity class example  JPA  msi_333  0
 HashMap class with generics  Collections  msi_333  0
 [offer] Class Video to jpg (JMF)  Java  Casper  2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  





Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2009
mileX v1.0 designed by codemiles team