PHP - Php Wsdl Help Needed
Hi all,
Similar TutorialsI was accessing a wsdl file, using php, using normal php SoapClient code. $soap=new SoapClient(WSDL_FILE_LOCATION); The code ran properly in localhost. But, when I uploaded the files in my free server 000webhost.com. I get the following error Fatal error: Class 'SoapClient' not found in /home/****/public_html/myfile.php on line 12 The error points to SoapClient(WSDL_FILE_LOCATION); line I couldn't understand the problem. Can someone please help me out? Thanks in advance I have a project at work to create a web service, using SOAP and have been provided a WSDL file to work from. I have never created a SOAP server before and I'm having some difficulty finding a good tutorial on building a SOAP server using a WSDL file. Can anyone provide any information, guidance, or links to some good materials to get started? Preferably a step by step tutorial that builds a SOAP server, using WSDL. Thanks! Hi, A consumer give me WSDL that describe SOAP messages in order to communicate together by Web services. The first WSDL is a webservice that I consume, no problem for this part. But the second one must be implemented in our side, a wsdl is provided to describe the ws that we must develop. The problem is that I don't know how to do? Is a tool exist to generate server code from a wsdl? should I develop from scratch and try to match the wsdl? Any clue will be welcome. Regards, Kyor Hi y'all. I've been looking at this for two days now and my head is starting to hurt from it.
I'm trying to integrate with an existing web service for client log-in and having trouble getting it done and Google is being very little help at this point. Here's the code, annotated where necessary:
namespace myNamespace; MyClass{ private $_apiLoginAddr = 'http://xxx.xxx.xxx.xxx:xxxx/ServiceAddress/Login.asmx?wsdl'; public function logIn($email,$id){ /* // these work... $testClient = new \SoapClient('http://www.webservicex.com/CurrencyConvertor.asmx?wsdl',array('trace'=>1,'exceptions'=>1)); $resp = $testClient->ConversionRate(array('FromCurrency'=>'USD','ToCurrency'=>'CAD')); print($resp->ConversionRateResult); $testClientAWS = new \SoapClient('http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl',array('trace'=>1,'exceptions'=>1)); $resp = $testClientAWS->ItemLookup(array('ItemID'=>'1430260319')); var_dump($resp); $testClientP = new \SoapClient('https://pilot.prove-uru.co.uk/URUws/uru10a.asmx?wsdl',array('trace'=>1,'execptions'=>1)); print_r($testClientP->__getFunctions()); die(); */ // turning off caching because apparently it's sometimes an issue... ini_set('soap.wsdl_cache_enbled','0'); ini_set('soap.wsdl_cache_ttl','0'); // this doesn't work even a little bit... try{ $creds = array( 'trace' => 1, 'exceptions' => 1, 'cache_wsdl' => 'WSDL_CACHE_NONE', 'soap_version' => SOAP_1_1, ); $client = new \SoapClient($this->_apiLoginAddr,$creds); $results = $client->WebsiteLogin(array('_Password'=>$id,'_UserName'=>$email)); var_dump($client->__getLastRequest()); print('break'); var_dump($client->__getLastResponse()); }catch(\SoapFault $e){ print('Exception thrown!'); var_dump($e); die(); } print('Succesfully completed call!'); var_dump($results); die(); } }Using this code, the browser churns for about a minute before I get the error "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://xxx.xxx.xxx.x...ceAddress/Login.asmx' : failed to load external entity "http://xxx.xxx.xxx.x...ess/Login.asmx", with or without the call to WebsiteLogin(). Now, I've also tried a non-wsdl version where I replaced the credentials array and SoapClient instantiation with the following: try{ $creds = array( 'trace' => 1, 'exceptions' => 1, 'cache_wsdl' => 'WSDL_CACHE_NONE', 'location' => $this->_apiLoginAddr, 'uri' => 'http://tempuri.org', 'soap_version' => SOAP_1_1, ); $client = new \SoapClient(null,$creds); $results = $client->WebsiteLogin(array('_Password'=>$id,'_UserName'=>$email)); /* see previous code block */Using this approach, my browser again churns for about a minute before I get the error "Could not connect to host". If I don't actually try to log in using the service's WebsiteLogin() function, SoapClient doesn't throw an error on this one and reports a successfully completed call. Which does me no good at all, because my users can't log in if I don't call the WebsiteLogin() function. I can visit the end-point directly in my browser and it's definitely there and active, and SoapUI has no problem at all with the request or the response. I've tried uncommenting the open_ssl.dll in my php.ini, turning the wsdl caching options off in the php.ini directly, and pretty much everything short of ritual sacrifice to no avail. My log in form is sending the credentials via AJAX to the logIn() method above, and all this is happening in a WordPress site. However, as the webservicex, webservices.amazon.com, and pilot.prove-uru.co.uk soap calls all complete successfully, I don't think that's an issue. I've spoken with the maintainer of the service gateway and he swears we're not blacklisted through the firewall, but nothing is working. Anybody come across anything similar? Or have better Google skills that can actually find an applicable answer? Or have any ideas at all? 'Cause I'm at a loss... I'm able to consume a local WSDL into PHP, and pass/return basic data successfully, but when I attempt to pass in objects that correspond to a complextype in the WSDL, I get the following error: SoapFault exception: [soapenv:Server] javax.xml.ws.WebServiceException: com.ibm.websphere.sca.ServiceRuntimeException: An error occurred while parsing native data: The error message is: java.lang.IllegalArgumentException: Mismatched parameter count: expecting 1 items, but got more.. Caused By: java.lang.IllegalArgumentException: Mismatched parameter count: expecting 1 items, but got more.: caused by: An error occurred while parsing native data: The error message is: java.lang.IllegalArgumentException: Mismatched parameter count: expecting 1 items, but got more.. Caused By: java.lang.IllegalArgumentException: Mismatched parameter count: expecting 1 items, but got more. in C:\wamp\www\SugarCE\testSOAPShawn.php:65 Stack trace: #0 [internal function]: SoapClient->__call('establishIdenti...', Array) #1 C:\wamp\www\SugarCE\testSOAPShawn.php(65): SoapClient->establishIdentity(Object(stdClass), Object(stdClass)) #2 {main} Here is the snippets from the WSDL: Code: [Select] <xsd:element name="establishIdentity"> − <xsd:complexType> − <xsd:sequence> − <xsd:element name="processId" nillable="true" type="xsd:string"> − <xsd:annotation> − <xsd:documentation> Identifies a specific instance of the dialogue process. Returned from the start() operation. </xsd:documentation> </xsd:annotation> </xsd:element> − <xsd:element name="identityAttributes" nillable="true" type="bons1:IdentityAttributes"> − <xsd:annotation> − <xsd:documentation> Key identifying attributes of a program participant. </xsd:documentation> </xsd:annotation> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> Here is my code with comments where the error occurs: <?php set_time_limit(0); require_once('nusoap.php'); $client = new SoapClient('C:\wsdl\BenefitDeterminationProcess_BenefitDialogueServiceSOAP.wsdl', array('trace' => 1)); $start = $client->__soapCall('start', array(new SoapParam((string)'GenesisID', 'prefix')), array('soapaction' => 'C:\wsdl\BenefitDeterminationProcess_BenefitDialogueServiceSOAP\start')); $processID = $start; $exchange = $client->__soapCall('exchangeOptions', array(new SoapParam($processID, 'processId')), array('soapaction' => 'C:\wsdl\BenefitDeterminationProcess_BenefitDialogueServiceSOAP\exchangeOptions')); $identityAttributes = new StdClass(); $identityAttributes->IdentityAttributes = new StdClass(); $identityAttributes->IdentityAttributes->ssn = 41441414; $identityAttributes->IdentityAttributes->firstName = 'John2'; $identityAttributes->IdentityAttributes->lastName = 'Doe2'; $identityAttributes->IdentityAttributes->gender = 'MALE'; $identityAttributes->IdentityAttributes->birthDate = null; try{ $identity = $client->establishIdentity($processID, $identityAttributes); //ERROR } catch (SoapFault $f){ echo "ERROR!"; } $end = $client->__soapCall('stop', array(new SoapParam($processID, 'processId')), array('soapaction' => 'C:\wsdl\BenefitDeterminationProcess_BenefitDialogueServiceSOAP\stop')); ?> Any assistance is greatly appreciated! Thanks. I'm trying to use a simple wsdl file and make a soap call but for the life of me I can't get it to work. Here's the wsdl file: <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="urn:gnHPD_Staging_Table_Submit_Generic" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s="urn:gnHPD_Staging_Table_Submit_Generic" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <xsd:schema elementFormDefault="qualified" targetNamespace="urn:gnHPD_Staging_Table_Submit_Generic"> <xsd:element name="Submit" type="s:InputMapping"/> <xsd:complexType name="InputMapping"> <xsd:sequence> <xsd:element name="Assigned_To_Group" type="xsd:string"/> <xsd:element name="AutoPush" type="s:AutoPushType"/> <xsd:element name="Case_Type" type="s:Case_TypeType"/> <xsd:element name="Category" type="xsd:string"/> <xsd:element name="Description" type="xsd:string"/> <xsd:element name="Details" type="xsd:string"/> <xsd:element name="Entry_Number" type="xsd:string"/> <xsd:element name="Integration_Application" type="xsd:string"/> <xsd:element name="Item" type="xsd:string"/> <xsd:element name="Priority" type="s:PriorityType"/> <xsd:element name="Source" type="s:SourceType"/> <xsd:element name="Submitter_UNIX" type="xsd:string"/> <xsd:element name="Summary" type="xsd:string"/> <xsd:element name="Type" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:simpleType name="AutoPushType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Auto Push"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="Case_TypeType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Incident"/> <xsd:enumeration value="Question"/> <xsd:enumeration value="Request"/> <xsd:enumeration value="Problem"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="PriorityType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="4"/> <xsd:enumeration value="3"/> <xsd:enumeration value="2"/> <xsd:enumeration value="1"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="SourceType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="Phone"/> <xsd:enumeration value="Requester"/> <xsd:enumeration value="Email"/> <xsd:enumeration value="Web"/> <xsd:enumeration value="NMP"/> </xsd:restriction> </xsd:simpleType> <xsd:element name="SubmitResponse" type="s:OutputMapping"/> <xsd:complexType name="OutputMapping"> <xsd:sequence> <xsd:element name="StagingTable_ID" type="xsd:string"/> <xsd:element name="HelpDesk_ID" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:element name="AuthenticationInfo" type="s:AuthenticationInfo"/> <xsd:complexType name="AuthenticationInfo"> <xsd:sequence> <xsd:element name="userName" type="xsd:string"/> <xsd:element name="password" type="xsd:string"/> <xsd:element minOccurs="0" name="authentication" type="xsd:string"/> <xsd:element minOccurs="0" name="locale" type="xsd:string"/> <xsd:element minOccurs="0" name="timeZone" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </wsdl:types> <wsdl:message name="SubmitSoapOut"> <wsdl:part element="s:SubmitResponse" name="parameters"/> </wsdl:message> <wsdl:message name="SubmitSoapIn"> <wsdl:part element="s:Submit" name="parameters"/> </wsdl:message> <wsdl:message name="ARAuthenticate"> <wsdl:part element="s:AuthenticationInfo" name="parameters"/> </wsdl:message> <wsdl:portType name="gnHPD_Staging_Table_Submit_GenericPortType"> <wsdl:operation name="Submit"> <wsdl:input message="s:SubmitSoapIn"/> <wsdl:output message="s:SubmitSoapOut"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="gnHPD_Staging_Table_Submit_GenericSoapBinding" type="s:gnHPD_Staging_Table_Submit_GenericPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="Submit"> <soap:operation soapAction="urn:gnHPD_Staging_Table_Submit_Generic/Submit" style="document"/> <wsdl:input> <soap:header message="s:ARAuthenticate" part="parameters" use="literal"></soap:header> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="gnHPD_Staging_Table_Submit_GenericService"> <wsdl:documentation>Generic Submit for HD</wsdl:documentation> <wsdl:port binding="s:gnHPD_Staging_Table_Submit_GenericSoapBinding" name="gnHPD_Staging_Table_Submit_GenericSoap"> <soap:address location="http://gremedydev:9090/midtier/services/ARService?server=gremedydev&webService=gnHPD_Staging_Table_Submit_Generic"/> </wsdl:port> </wsdl:service> </wsdl:definitions> Here's my php code: $params = array( "Submitter_UNIX"=>'myunix', "Source"=>'Web', "Summary"=>'Test1', "Description"=>'Test1', "Category"=>'test services', "Type"=>'test solutions', "Item"=>'Problem', "Assigned_To_Group"=>'test solutions', "Case_Type"=>'Problem', "Priority"=>'4', "AutoPush" => 'Auto Push', "Details"=>'Test Details', "Entry_Number"=>'', "Integration_Application"=>'MyMobile' ); $client = new SoapClient('http://gremedydev:9090/midtier/WSDL/gremedydev/gnHPD_Staging_Table_Submit_Generic',array('trace' => 1 )); $result = $client->Submit($params); I get this reply Code: [Select] Fatal error: Uncaught SoapFault exception: [ns1:Server.userException] MessageType: 2 MessageNum: 149 MessageText: A user name must be supplied in the control record AppendedText: in D:\Inetpub\wwwroot\myMobile\test\testwsdl2.php:29 Stack trace: #0 [internal function]: SoapClient->__call('Submit', Array) #1 D:\Inetpub\wwwroot\myMobile\test\testwsdl2.php(29): SoapClient->Submit(Array) #2 {main} thrown in D:\Inetpub\wwwroot\myMobile\test\testwsdl2.php on line 29 The only thing I can think of missing here is headers but I have no idea how to configure that. Any insight is greately appreciated! Hello, I'm working with a website's soap services to communicate with their servers, They have sent me a sample code of .Net that works properly for all methods of their web services, But while I'm trying to use the same web services via php-soap the functions that has array of string as a parameter for a method doesn't work at all, ( the other functions work fine ) Here is the sample code of .Net: Code: [Select] webServiceType ws = new webServiceType(); string res = ws.methodX("username", "password", new string[] { "x" , "y" }); but this code in PHP doesn't work fine and throw an exception $client = new SoapClient("http://webserviceURL.com?WSDL",array("features" => SOAP_SINGLE_ELEMENT_ARRAYS)); $response = $client->methodX("username","password",array ( "x" , "y" )); Any suggestion on how to pass an array of string to a method via soap- WSDL? Hi, Help would be very appreciative I am doing some preliminary testing for future projects. A company we are working with supplied us with a wsdl file to communicate with their system. I want to use PHP to run functions in the wsdl file but I got stuck after calling a function and I get no response back. Below is my test snippet PHP code. Below the PHP code is the wsdl file (also attached change the extension from .txt to .wsdl before using it). When I run the php code from command line (linux server) I get a "Segmentation fault" back. I am assuming that the error is coming from the wsdl file. I am not high fly on wsdl code and I would not really know what I'm doing if I started chopping and dicing the wsdl file. <?php $client = new SoapClient("http://172.21.1.24:7070/comactivity/axis2services/OrderEntryWebService?wsdl/"); //if the wsdl exist locally use //$client = new SoapClient("file.wsdl"); //echo var_export($client->__getFunctions(),true); $arr_head=array( "cuno" =>"1234", "ortp" =>"ORD", "faci" =>"M00", "rldt" =>"20110811" ); try { $arr = $client->__soapCall("addBatchHead", $arr_head); } catch (SoapFault $exception){ echo $exception; } ?> =========== WSDL file within these tags ============= <?xml version="1.0" encoding="utf-16"?> <wsdl:definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns="http://services.web" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://services.web" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:documentation>Order Entry Web Service</wsdl:documentation> <wsdl:types> <xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://services.web"> <xs:element name="addBatchHead"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="cuno" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="ortp" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="faci" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="rldt" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="addBatchHeadResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="addBatchHeadReturn" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="addBatchLine"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="tempOrno" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="itno" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="orqt" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="whlo" nillable="true" type="xs:string" /> <xs:element minOccurs="0" name="dlsp" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="addBatchLineResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="addBatchLineReturn" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="confirm"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="tempOrno" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="confirmResponse"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="confirmReturn" nillable="true" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </wsdl:types> <wsdl:message name="addBatchLineRequest"> <wsdl:part name="parameters" element="ns:addBatchLine" /> </wsdl:message> <wsdl:message name="confirmRequest"> <wsdl:part name="parameters" element="ns:confirm" /> </wsdl:message> <wsdl:message name="confirmResponse"> <wsdl:part name="parameters" element="ns:confirmResponse" /> </wsdl:message> <wsdl:message name="addBatchHeadResponse"> <wsdl:part name="parameters" element="ns:addBatchHeadResponse" /> </wsdl:message> <wsdl:message name="addBatchLineResponse"> <wsdl:part name="parameters" element="ns:addBatchLineResponse" /> </wsdl:message> <wsdl:message name="addBatchHeadRequest"> <wsdl:part name="parameters" element="ns:addBatchHead" /> </wsdl:message> <wsdl:portType name="OrderEntryWebServicePortType"> <wsdl:operation name="addBatchLine"> <wsdl:input wsaw:Action="urn:addBatchLine" message="ns:addBatchLineRequest" /> <wsdl:output wsaw:Action="urn:addBatchLineResponse" message="ns:addBatchLineResponse" /> </wsdl:operation> <wsdl:operation name="addBatchHead"> <wsdl:input wsaw:Action="urn:addBatchHead" message="ns:addBatchHeadRequest" /> <wsdl:output wsaw:Action="urn:addBatchHeadResponse" message="ns:addBatchHeadResponse" /> </wsdl:operation> <wsdl:operation name="confirm"> <wsdl:input wsaw:Action="urn:confirm" message="ns:confirmRequest" /> <wsdl:output wsaw:Action="urn:confirmResponse" message="ns:confirmResponse" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="OrderEntryWebServiceHttpBinding" type="ns:OrderEntryWebServicePortType"> <http:binding verb="POST" /> <wsdl:operation name="addBatchLine"> <http:operation location="OrderEntryWebService/addBatchLine" /> <wsdl:input> <mime:content part="addBatchLine" type="text/xml" /> </wsdl:input> <wsdl:output> <mime:content part="addBatchLine" type="text/xml" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="addBatchHead"> <http:operation location="OrderEntryWebService/addBatchHead" /> <wsdl:input> <mime:content part="addBatchHead" type="text/xml" /> </wsdl:input> <wsdl:output> <mime:content part="addBatchHead" type="text/xml" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="confirm"> <http:operation location="OrderEntryWebService/confirm" /> <wsdl:input> <mime:content part="confirm" type="text/xml" /> </wsdl:input> <wsdl:output> <mime:content part="confirm" type="text/xml" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="OrderEntryWebServiceSoap11Binding" type="ns:OrderEntryWebServicePortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="addBatchLine"> <soap:operation soapAction="urn:addBatchLine" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="addBatchHead"> <soap:operation soapAction="urn:addBatchHead" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="confirm"> <soap:operation soapAction="urn:confirm" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="OrderEntryWebServiceSoap12Binding" type="ns:OrderEntryWebServicePortType"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="addBatchLine"> <soap12:operation soapAction="urn:addBatchLine" style="document" /> <wsdl:input> <soap12:body use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="addBatchHead"> <soap12:operation soapAction="urn:addBatchHead" style="document" /> <wsdl:input> <soap12:body use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="confirm"> <soap12:operation soapAction="urn:confirm" style="document" /> <wsdl:input> <soap12:body use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="OrderEntryWebService"> <wsdl:port name="OrderEntryWebServiceHttpEndpoint" binding="ns:OrderEntryWebServiceHttpBinding"> <http:address location="http://172.21.1.24:7070/comactivity/axis2services/OrderEntryWebService/" /> </wsdl:port> <wsdl:port name="OrderEntryWebServiceHttpSoap12Endpoint" binding="ns:OrderEntryWebServiceSoap12Binding"> <soap12:address location="http://172.21.1.24:7070/comactivity/axis2services/OrderEntryWebService/" /> </wsdl:port> <wsdl:port name="OrderEntryWebService" binding="ns:OrderEntryWebServiceSoap11Binding"> <soap:address location="http://172.21.1.24:7070/comactivity/axis2services/OrderEntryWebService/" /> </wsdl:port> </wsdl:service> </wsdl:definitions> ============== End WSDL file =================== Thank you /Martin [attachment deleted by admin] Hello, I'm working on a project that will let users access a website to view results. I getting via a FTP server CSV files. Files look like that (in French): "ARTICLES; BOISSONS 5.50% ; 1; ORANGINA ; 2.50; 2; PERRIER ; 5.00; 2; SCHWEPPES ; 5.00; ----------------------------------------; 5; BOISSONS 5.50% ; 12.50; RATIO %; 6.94; BOISSONS 19.60% ; 4; PELFORTH ; 10.00; 1; CHIVAS ; 7.00; 1; LIQUEUR ; 5.50; ----------------------------------------; 6; BOISSONS 19.60% ; 22.50; RATIO %; 12.50; RESTAURANT ; 1; BOUILLON POT AU FEU ; 7.00; 2; JAMBON D'AUVERGNE ; 20.00; 2; TERRINE PIED DE PORC; 16.00; 1; CASSOULET ; 20.00; 2; CONFIT DE CANARD ; 46.00; 1; CUISSE DE LAPIN ; 18.00; 1; MOURTAYROL ; 18.00; ----------------------------------------; 10; RESTAURANT ; 145.00; RATIO %; 80.56; ----------------------------------------; TOTAL ; ARTICLES ; 180.00; ------------------------------------------; ------------------------------------------; ------------------------------------------; REGLEMENTS; 2; ESPECES ; 109.50; 1; CARTE ; 70.50; ------------------------------------------; TOTAL ; REGLEMENTS; 180.00;" Basically, I'm trying to write code to "sort" each categorie (ARTICLES, REGLEMENTS....) Here is what I'd like to get: A B C D E ARTICLES; BOISSONS 5.50% ; 1; ORANGINA ; 2; PERRIER ; 2; SCHWEPPES ; BOISSONS 19.60% ; 4; PELFORTH ; 1; CHIVAS ; 1; LIQUEUR ; RESTAURANT ; 1; BOUILLON POT AU FEU ; 2; JAMBON DE DINDE ; 2; TERRINE PIED DE PORC; 1; CASSOULET ; 2; CONFIT DE CANARD ; 1; CUISSE DE LAPIN ; 1; MOURTAYROL ; TOTAL ; 5; BOISSONS 5.50% ; 12.50; 6; BOISSONS 19.60% ; 22.50; 10; RESTAURANT ; 145.00; REGLEMENTS; 2; ESPECES ; 109.50; 1; CARTE ; 70.50; A, B, D only names C, E only numbers These datas will be used to generate pie charts Thanks for your attention Helo dear people, I need some halp with mine script. This is part of it that works: function msan_getxmlinfo() { //global $local; //msan_download(); $path = dirname(__FILE__).'/xml/pricelist.xml'; $doc = new DOMDocument(); $doc->load($path); $msan = $doc->getElementsByTagName( "Table" ); $result = array(); foreach( $msan as $table ) { $codes = $table->getElementsByTagName( "ProductCode" ); $code = $codes->item(0)->nodeValue; $prices = $table->getElementsByTagName( "ProductPartnerPrice" ); $price = $prices->item(0)->nodeValue; $price = sprintf('%6f',$price); $availables = $table->getElementsByTagName( "ProductAvailability" ); $available = $availables->item(0)->nodeValue; $result[$code] = array('code'=>$code,'price'=>$price,'available'=>$available); } //echo "<pre>"; //print_r($result); //@unlink($path); return $result; } But now i need to insert one more element called "ProductDiscount" And aditional condition for proper price setting related so that when "ProductDiscount" is 0 (zero) then increase price by 3% and if theres any other value than 0 (zero) leave price as is. I was trying somthing like this but i cant get price increase: function msan_getxmlinfo() { $path = dirname(__FILE__).'/xml/pricelist.xml'; $doc = new DOMDocument(); $doc->load($path); $msan = $doc->getElementsByTagName( "Table" ); $result = array(); foreach( $msan as $table ) { $codes = $table->getElementsByTagName( "ProductCode" ); $code = $codes->item(0)->nodeValue; $prices = $table->getElementsByTagName( "ProductPartnerPrice" ); $price = $prices->item(0)->nodeValue; $discounts = $table->getElementsByTagName( "ProductDiscount"); if($discounts->item(0)=="0") { $price = $price*1.03; } else { $price = $prices->item(0)->nodeValue; } $price = sprintf('%6f',$price); $availables = $table->getElementsByTagName( "ProductAvailability" ); $available = $availables->item(0)->nodeValue; $result[$code] = array('code'=>$code,'price'=>$price,'available'=>$available,'discount'=>$discount); } return $result; } Help needed! This code is supposed to pull data from a mysql database so I can edit it. that part works. The other part of this code is, it's supposed to send an email to an email address based off of the "location" field. If I choose "Office1, it will send the data to the mysql database as well as send an email to the email address in listed for office1 with the data that went to the mysql database. Can someone take a look & correct my code issues? Code: [Select] <p> To go to the main page <a href="http://tnep-g-psrflow/flow/index.html">click here</a>.</p> <?php # edit_dqa.php $page_title = 'Edit a Record'; $con = mysql_connect("localhost","uname","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("psrflow", $con); //$result = mysql_query("SELECT * FROM psrinfo "); // Check for a valid user ID, through GET or POST. if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { // Accessed through view_users.php $id = $_GET['id']; } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { // Form has been submitted. $id = $_POST['id']; } else { // No valid ID, kill the script. echo '<h1 id="mainhead">Page Error</h1> <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; include ('./includes/footer.html'); exit(); } // Check if the form has been submitted. if (isset($_POST['submitted'])) { $errors = array(); // Initialize error array. if (empty($_POST['pacts'])) { $errors[] = 'You forgot to enter your PACTS number. If there is no PACTS # you can enter 0000'; } else { $pt = $_POST['pacts']; } if (empty($_POST['fname'])) { $errors[] = 'You forgot to enter the first name.'; } else { $fn = $_POST['fname']; } if (empty($_POST['lname'])) { $errors[] = 'You forgot to enter the last name.'; } else { $ln = $_POST['lname']; } if (empty($_POST['status'])) { $errors[] = 'You forgot to enter a status.'; } else { $st = $_POST['status']; } if (empty($_POST['assgn_date'])) { $errors[] = 'You forgot to enter an assign date.'; } else { $ad = $_POST['assgn_date']; } if (empty($_POST['interv_date'])) { $errors[] = 'You forgot to enter an interview date.'; } else { $iv = $_POST['interv_date']; } if (empty($_POST['due_rev'])) { $errors[] = 'You forgot to enter a due to reviewer date.'; } else { $rv = $_POST['due_rev']; } if (empty($_POST['due_suspo'])) { $errors[] = 'You forgot to enter a due to SUSPO date.'; } else { $sus = $_POST['due_suspo']; } if (empty($_POST['due_clerk'])) { $errors[] = 'You forgot to enter a due to clerk date.'; } else { $clk = $_POST['due_clerk']; } if (empty($_POST['due_owner'])) { $errors[] = 'You forgot to enter a due to owner date.'; } else { $jdg = $_POST['due_owner']; } if (empty($_POST['location'])) { $errors[] = 'You forgot to enter a location.'; } else { $loc = $_POST['location']; } if (empty($_POST['employee'])) { $errors[] = 'You forgot to enter a employee.'; } else { $off = $_POST['employee']; } if (empty($_POST['sent_date'])) { $errors[] = 'You forgot to enter a sentence date.'; } else { $sd = $_POST['sent_date']; } if (empty($_POST['oth_date'])) { $errors[] = 'You forgot to enter an other date.'; } else { $oth = $_POST['oth_date']; } if (empty($_POST['due_attny'])) { $errors[] = 'You forgot to enter an date.'; } else { $atn = $_POST['due_attny']; } if (empty($errors)) { // If everything's OK. // Make the query. $query = "UPDATE psrinfo SET pacts='$pt', fname='$fn', lname='$ln', status='$st', location='$loc', employee='$off', sent_date='$sd', oth_date='$oth', assgn_date='$ad', interv_date='$iv', due_rev='$rv', due_suspo='$sus', due_clerk='$clk', due_attny='$atn', due_owner='$jdg' WHERE fid=$id"; //$query = "UPDATE psrinfo SET pacts='$pt', fname='$fn', lname='$ln', status='$st', location='$loc', assgn_date='$ad', interv_date='$iv', due_rev='$rv', due_suspo='$sus', due_clerk='$clk', due_attny='$atn', due_owner='$jdg', oth_date='$oth', employee='$off' WHERE fid=$id"; $result = @mysql_query ($query); // Run the query. $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); if ((substr($url, -1) == '/') OR (substr($url, -1) == '//')) { $url = substr ($url, 0, -1); } $url ='/flow/index.html'; header("Location: $url"); exit(); } else { // Report the errors. echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { // Print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p><p><br /></p>'; } // End of if (empty($errors)) IF. } // End of submit conditional. // Retrieve the user's information. $query = "SELECT pacts, fname, lname, status, employee, location, assgn_date, interv_date, sent_date, oth_date, due_rev, due_suspo, due_clerk, due_attny, due_owner FROM psrinfo WHERE fid = " . $_REQUEST['id']; $result = @mysql_query ($query); // Run the query. if (mysql_num_rows($result) == 1) { // Valid user ID, show the form. // Get the user's information. $row = mysql_fetch_array ($result, MYSQL_NUM); ?> <script type="text/javascript"> var valid; function d2(v) { return (v<10)?("0"+v):v; } function dcheck(form) { var a = form.assgn_date.value; var s = form.sent_date.value; var i = form.interv_date.value; var dr = form.due_rev.value var su = form.due_suspo var clk = form.due_clerk var att = form.due_attny var jdg = form.due_owner var assn = new Date(a); var sent = new Date(s); var intv = new Date(i); var due_rev = new Date(dr); var due_suspo = new Date(su); var due_clerk = new Date(clk); var due_attny = new Date(att); var due_owner = new Date(jdg); if (isNaN(intv)) { intv = new Date(assn.getFullYear(),assn.getMonth(),assn.getDate()+0); } if (isNaN(assn)) { assn = new Date(assn.getFullYear(),assn.getMonth(),assn.getDate()+0); } if (isNaN(due_rev)) { due_rev = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-42); } if (isNaN(due_suspo)) { due_suspo = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-40); } if (isNaN(due_clerk)) { due_clerk = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-38); } if (isNaN(due_attny)) { due_attny = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-36); } if (isNaN(due_owner)) { due_owner = new Date(sent.getFullYear(),sent.getMonth(),sent.getDate()-7); } switch(due_rev.getDay()){ case 0: due_rev.setDate(due_rev.getDate() - 1); // take one for Sunday case 6: due_rev.setDate(due_rev.getDate() - 1); // take two for Sunday or one for Saturday } switch(due_suspo.getDay()){ case 0: due_suspo.setDate(due_suspo.getDate() - 1); // take one for Sunday case 6: due_suspo.setDate(due_suspo.getDate() - 1); // take two for Sunday or one for Saturday } switch(due_clerk.getDay()){ case 0: due_clerk.setDate(due_clerk.getDate() - 1); // take one for Sunday case 6: due_clerk.setDate(due_clerk.getDate() - 1); // take two for Sunday or one for Saturday } switch(due_attny.getDay()){ case 0: due_attny.setDate(due_attny.getDate() - 1); // take one for Sunday case 6: due_attny.setDate(due_attny.getDate() - 1); // take two for Sunday or one for Saturday } switch(due_owner.getDay()){ case 0: due_owner.setDate(due_owner.getDate() - 1); // take one for Sunday case 6: due_owner.setDate(due_owner.getDate() - 1); // take two for Sunday or one for Saturday } switch(due_rev.getDay()){ case 0: due_rev.setDate(due_rev.getDate() - 1); // take one for Sunday case 6: due_rev.setDate(due_rev.getDate() - 1); // take two for Sunday or one for Saturday } //form.assgn_date.value = (assn.getFullYear()+0) + "-" + d2(assn.getMonth()+1) + "-" + d2(assn.getDate()); //form.interv_date.value = (intv.getFullYear()+0) + "-" + d2(intv.getMonth()+1) + "-" + d2(intv.getDate()); form.sent_date.value = (sent.getFullYear()+0) + "-" + d2(sent.getMonth()+1) + "-" + d2(sent.getDate()); form.due_rev.value = (due_rev.getFullYear()+0) + "-" + d2(due_rev.getMonth()+1) + "-" + d2(due_rev.getDate()); form.due_suspo.value = (due_suspo.getFullYear()+0) + "-" + d2(due_suspo.getMonth()+1) + "-" + d2(due_suspo.getDate()); form.due_clerk.value = (due_clerk.getFullYear()+0) + "-" + d2(due_clerk.getMonth()+1) + "-" + d2(due_clerk.getDate()); form.due_attny.value = (due_attny.getFullYear()+0) + "-" + d2(due_attny.getMonth()+1) + "-" + d2(due_attny.getDate()); form.due_owner.value = (due_owner.getFullYear()+0) + "-" + d2(due_owner.getMonth()+1) + "-" + d2(due_owner.getDate()); return true; } </script> <?php if (isset($_REQUEST['Submit'])) { # THIS CODE TELL MYSQL TO INSERT THE DATA FROM THE FORM INTO YOUR MYSQL TABLE $sql = "INSERT INTO $db_table(fname,lname,pacts,assgn_date,interv_date) values ('".mysql_real_escape_string(stripslashes($_REQUEST['fname']))."','".mysql_real_escape_string(stripslashes($_REQUEST['lname']))."','".mysql_real_escape_string(stripslashes($_REQUEST['pacts']))."','".mysql_real_escape_string(stripslashes($_REQUEST['assgn_date']))."','".mysql_real_escape_string(stripslashes($_REQUEST['interv_date']))."')"; if($result = mysql_query($sql ,$db)) { ##################################################################### switch($_REQUEST['location']) { case "Office1": $email = "office1@email.com"; break; case "Office2": $email = "office2@email.com"; break; default: echo "Error, no location selected!!!"; break; } $message = "<p>A date has changed. Please check the database</p><br> First Name: {$_REQUEST['fname']}<br>Last Name : {$_REQUEST['lname']}<br>PACTS No : {$_REQUEST['pacts']}<br>Date Assigned : {$_REQUEST['assgn_date']}<br>Date Interviewed : {$_REQUEST['interv_date']}<br>}"; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $subject = "Please Review the Changed Data"; $headers .= "To: DQA <$email>\n"; $headers .= "From: PODDS <sender email>\n"; if (mail($email, $subject, $message, $headers)) { echo "<p><center><h2>The Office</h2></center></p>"; echo "<p><h3><center>Our Town</center></h3></p>"; echo "<center>An email has been sent to someone for editing and "; } else { echo "This system is not working properly. Please contact IT so he can fix it."; } ########################################################################## echo '<form action="edit_dqa.php" method="post"> <fieldset><legend><h1> You are editing a record!</h1></legend> <b>PACTS No:</b> <br><input type="text" name="pacts" size="15" maxlength="30" value="'.$row[0].'" /><br> <b>First Name:</b> <br><input type="text" name="fname" size="15" maxlength="30" value="'.$row[1].'" /><br /> <b>Last Name:</b> <br><input type="text" name="lname" size="15" maxlength="30" value="'.$row[2].'" /><br /> <b>Status: </b><br><input type="text" name="status" size="15" maxlength="30" value="'.$row[3].'" /> <br> <b>Location: </b><br><input type="text" name="location" size="15" maxlength="30" value="'.$row[5].'" /><br> <b>employee: </b><br><input type="text" name="employee" size="15" maxlength="30" value="'.$row[4].'" /> <br> <b>Sentence Date: MM/DD/YYYY </b><br><input type="text" name="sent_date" size="15" maxlength="30" value="'.$row[8].'" /> <br> <p><input type="button" value="Calculate" onclick="return dcheck(this.form);"> <b>-----------------------------------------------------------</b> <br /><br> <b>Other Date:</b><br><input type="text" name="oth_date" size="15" maxlength="30" value="'.$row[9].'" /> <br> <b>Assign Date: </b><br><input type="text" name="assgn_date" size="15" maxlength="30" value="'.$row[6].'" /> <br> <b>Interview Date: </b><br><input type="text" name="interv_date" size="15" maxlength="30" value="'.$row[7].'" /> <br> <b>Due to Reviewer:</b><br><input type="text" name="due_rev" size="15" maxlength="30" value="'.$row[10].'" /> <br> <b>Due to SUSPO:</b><br><input type="text" name="due_suspo" size="15" maxlength="30" value="'.$row[11].'" /> <br> <b>Due to Clerk:</b><br><input type="text" name="due_clerk" size="15" maxlength="30" value="'.$row[12].'" /> <br> <b>Due to Attorney:</b><br><input type="text" name="due_attny" size="15" maxlength="30" value="'.$row[13].'" /> <br> <b>Due to owner:</b><br><input type="text" name="due_owner" size="15" maxlength="30" value="'.$row[14].'" /> <br> <br> </fieldset> <div align="left"><input type="submit" name="submit" value="Submit" /></div> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="id" value="' . $id . '" /> </form>'; } else { // Not a valid user ID. echo '<h1 id="mainhead">Page Error</h1> <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; } mysql_close(); // Close the database connection. ?> Hello i have coded a script that checks the post values then updates db recoreds thing is. i have this line of code if($name && $price && $ship && $paypal && $des && $cato_id !== ""){ do code }else{ do this } when the client enters 0 in the ship and price the do code does not get excuted how can i solve this problem thanks <?php # Script 10.3 - upload_image.php // This page is for editing a product. require_once(MYSQL);; // Check for a valid product ID, through GET or POST: if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { $id = $_GET['id']; // Make the query: $q = "SELECT name, price, ship, paypal, descr FROM products WHERE product_id='$id' LIMIT 1"; $r = mysqli_query ($dbc, $q); if(mysqli_affected_rows($dbc) == 1) {//Ran Ok ready to delete file $row = mysqli_fetch_array ($r, MYSQLI_ASSOC); } } else { die('<p class="error">Sorry this page is not available or has been accessed in error</p>'); } // Check if the form has been submitted: if (isset($_POST['submitted'])) { require_once(MYSQL); // Trim all the incoming data: $trimmed = array_map('trim', $_POST); // Assume invalid values: $name = $price = $ship = $paypal = $des = $cato_id = FALSE; // Check for a product name: if (preg_match ('/^[A-Z \'.-]{2,20}$/i', $trimmed['name'])) { $name = mysqli_real_escape_string ($dbc, $trimmed['name']); } else { echo '<p class="error">Please enter a product name</p>'; } // Check for a price if (is_numeric($trimmed['price'])) { $price = mysqli_real_escape_string ($dbc, $trimmed['price']); } else { echo '<p class="error">Please enter a price</p>'; } // Check for a price if (is_numeric($trimmed['shipping_cost'])) { $ship = mysqli_real_escape_string ($dbc, $trimmed['shipping_cost']); } else { echo '<p class="error">Please enter a shipping cost</p>'; } // Check for paypal code: if ($_POST['paypal']) { $paypal = mysqli_real_escape_string ($dbc, $trimmed['paypal']); } else { echo '<p class="error">Please enter the paypal code</p>'; } // Check for product description: if ($_POST['product_des']) { $des = mysqli_real_escape_string ($dbc, $trimmed['product_des']); } else { echo '<p class="error">Please enter a product description</p>'; } // Check for product description: if ($_POST['cato_id']) { $cato_id = mysqli_real_escape_string ($dbc, $trimmed['cato_id']); } else { echo '<p class="error">Please Select a category</p>'; } if ($name && $price && $ship && $paypal && $des && $cato_id !== "") { // If everything's OK... $q = "UPDATE products SET name='$name', price='$price', ship='$ship', paypal='$paypal', descr='$des', cato='$cato_id' WHERE product_id='$id'"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); echo '<p class="success"><em>The Product Information has Been Updated</em></p>'; } if($_POST['oldimage'] == 0){ // Check for an uploaded file: if (isset($_FILES['upload'])) { // Validate the type. Should be JPEG or PNG. $allowed = array ('image/pjpeg', 'image/jpeg', 'image/JPG', 'image/X-PNG', 'image/PNG', 'image/png', 'image/x-png'); if (in_array($_FILES['upload']['type'], $allowed)) { function findexts ($filename) { $filename = strtolower($filename) ; $exts = split("[/\\.]", $filename) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } //This applies the function to our file $ext = findexts ($_FILES['upload']['name']); //This line assigns a random number to a variable. You could also use a timestamp here if you prefer. $timestamp = time(); //This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended. $default_name = $timestamp."."; //This assigns the subdirectory you want to save into... make sure it exists! $target = TARGET; $image = "/photos/"; //This combines the directory, the random file name, and the extension $target = $target . $default_name.$ext; $image = $image . $default_name.$ext; // Move the file over. if (move_uploaded_file ($_FILES['upload']['tmp_name'], "$target")) { // Make the query: $q = "SELECT image FROM products WHERE product_id='$id' LIMIT 1"; $r = @mysqli_query ($dbc, $q); if(mysqli_affected_rows($dbc) == 1) {//Ran Ok ready to delete file $row = @mysqli_fetch_array ($r, MYSQLI_NUM); $q = "UPDATE products SET image='$image' WHERE product_id='$id'"; $r = @mysqli_query ($dbc, $q); //Delete from file $myFile = DELPATH . $row[0]; if (file_exists($myFile)) { //Delete from file if(unlink($myFile)){ echo "<p class=\"success\">File: $row[0] has been successfully deleted</p>"; } } echo '<p class="success"><em>The Product Image has Been Changed</em></p>'; } } // End of move... IF. } else { // Invalid type. echo '<p class="error">Please upload a JPEG or PNG image.</p>'; } // Check for an error: if ($_FILES['upload']['error'] > 0) { echo '<p class="error">The file could not be uploaded because: <strong>'; // Print a message based upon the error. switch ($_FILES['upload']['error']) { case 1: print 'The file exceeds the upload_max_filesize setting in php.ini.'; break; case 2: print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form.'; break; case 3: print 'The file was only partially uploaded.'; break; case 4: print 'No file was uploaded.'; break; case 6: print 'No temporary folder was available.'; break; case 7: print 'Unable to write to the disk.'; break; case 8: print 'File upload stopped.'; break; default: print 'A system error occurred.'; break; } // End of switch. print '</strong></p>'; } // End of error IF. // Delete the file if it still exists: if (file_exists ($_FILES['upload']['tmp_name']) && is_file($_FILES['upload']['tmp_name']) ) { unlink ($_FILES['upload']['tmp_name']); } } // End of isset($_FILES['upload']) IF. } } i need help with mysql.php this keeps coming up when i try to log into my game Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /home/tassie12/domains/kronicalwars.co.cc/public_html/mysql.php on line 2 Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/tassie12/domains/kronicalwars.co.cc/public_html/mysql.php on line 3 Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/tassie12/domains/kronicalwars.co.cc/public_html/authenticate.php on line 30 Access denied for user 'root'@'localhost' (using password: YES) can someone send me the code for mysql.php for mccodes and tell me where to put the database user and pass? Hey guys, I need some help with a small project I'm doing. I have a radio receiver hooked up to a serial port and have it streaming on a web page. I need to create a spectrum plot which will show the given frequency strength. I have the chart all ready i just need a way to extract the data from the radio so it goes onto the graph. Anyone know how to do this ? Also for the chart i will be using google charts I've been surfing the net recently for php cms system that I can implement into my clients websites, I've come across a really cool cms system pagelime. The cool thing about pagelime is that you can assign a css class to any div in the html document and pagelime can remotely read this html document and make that css div editable. then pagelime can save or generate the newly edited page. So... my question is how is this done? do they parse the html document via ftp into a php string then load it into a editor where the code is updated via ajax then remotely written back. Is there a industry word for this type of system? that I could use to find tuts on this topic? If someone is willing to point me in the right direction for more info then I will gladly share my finished cms system Thanks Danny Here's my code snippet. Code: [Select] if(preg_match("/^[ a-zA-Z1-42]+/", $_POST['name'])){ $name=$_POST['name']; $namer=$name; $result = mysql_query("select `resource` from resources where `resource_id` =" .$namer. "ORDER BY `resource_id` ASC "); echo "<br/>The following nations have " .$namer. " as a resource\n"; //-query the database table $sql="SELECT id, nation_id, ruler, resource1, resource2 FROM TS1 WHERE resource1 LIKE '%" . $name . "%' OR resource2 LIKE '%" . $name ."%'"; //-run the query against the mysql query function $result=mysql_query($sql); //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ $ID=$row['id']; $Ruler=$row['ruler']; //-display the result of the array echo "<ul>\n"; echo "<li>" . "<a href=\"searcher.php?id=$ID\">" .$Ruler. "</a></li>\n"; echo "</ul>"; } } else{ echo "<p>Please enter a search query</p>"; } } } Basically I have a number that's posted from a form field from another page to this page. It displays correctly on the results page but what i'm trying to do now is get that number to change based on the query at the top '' $result = mysql_query("select `resource` from resources where `resource_id` =" .$namer. "ORDER BY `resource_id` ASC "); " So if the number 3 (which is in the `resource_id` column) was posted it will display a result (which is in the `resource` column). But it just seems that the query isn't going through and it continues to display the 3 which was originally posted instead of changing 3 to a number in the database. I was thinking of performing a while loop so it just just displays the result of the query.. something like this: Code: [Select] $name=$_POST['name']; $namer=$name; $result = mysql_query("select `resource` from resources where `resource_id` =" .$namer. "ORDER BY `resource_id` ASC "); while($row = mysql_fetch_array($result)) { echo "<br/>The following nations have " . $row['resource'] . " as a resource\n"; }But that seems to have more problems as it doesn't display anything at all, not even the original number I had. I don't think it's a big problem.. Maybe something i've just overlooked? I have a form with dynamic text boxes that have dynamic names (i.e., TextBox1, TextBox2, etc.). How do I get those variables passed into php? I have tried and tried...even googled it, with no solid luck. Any help, immediately, would be so much appreciated. Hi I am new here and I am not a PHP specialist. I run a website (www.theowl.com) and last week I upgraded from PHP 4.X to 5.x on the Namesco server. Everything worked except one thing.... I commissioned an EDI link to DHL, and this was setup using PHP FTP. This system works automatically plus I have a manual link to trigger orders. Since upgrading PHP the automatic process has stopped but the manual process still works fine. Would anybody be able to help. I have attached what I think is the correct file. I am happy to pay for peoples time. i have a piece of code which subtracts credits every time a button is clicked. the original code works fine. I have since added a bonus_credit column, where i want it to function like this. if buy_credit = 0 and bonus_credit>0 then subtract from the bonus credit, but still do everything else its supposed to do.. here is the original code i had $selRes=mysql_query("SELECT buy_credit from user where id='".$hb_id."' and buy_credit>0"); if(mysql_affected_rows()>0) { $b_comm=0; $bc_updqry=mysql_query("UPDATE user set buy_credit=buy_credit-1 where id='".$hb_id."'"); $updqry=mysql_query("UPDATE cars set b_fee_paid_status='1' where id='".$aid."'"); } here is my modified code, but it doesn't seem to subtract from buy_credit if buy_credit is >0.. it should only kick in the bonus_credit usage if buy_credit is 0 $selRes=mysql_query("SELECT buy_credit,bonus_credit from user where id='".$hb_id."' and buy_credit>0 OR bonus_credit>0"); if(mysql_affected_rows()>0) { $b_comm=0; if($selRes['buy_credit']!=0) { $bc_updqry=mysql_query("UPDATE user set buy_credit=buy_credit-1 where id='".$hb_id."'"); } else { $bc_updqry=mysql_query("UPDATE user set bonus_credit=bonus_credit-1 where id='".$hb_id."'"); } $updqry=mysql_query("UPDATE cars set b_fee_paid_status='1' where id='".$aid."'"); } your help is appreciated. Hello: I have a small chunck of code that dosplays data depending on which PlayerID is selected. Like so: Code: [Select] <?php $myvar = $_REQUEST['PlayerID']; ?> ... <?php if ( $myvar == "1" ) { echo "Your name is Tina"; } elseif ( $myvar == "2" ) { echo "Your name is Sue"; } else { echo "Your name is Jill"; } ?> This works fine - no errors - but I am use to ASP and using an "End If" after "Else" ... Is this not needed in PHP? Thanks. |