Jump to content

Synergic

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Synergic's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. btw if i change getBook to getBookX i get invalid method, so i know i can connect to the web service.
  2. anyone? been stuck on it for days....
  3. I have a web service which i want to consume via PHP. Whenever i attempt to communicate with it it comes up with: "Server was unable to process request. --> Object reference not set to an instance of an object." Googled it and got the following: http://php.net/soap_soapclient_soapcall Apparently this code should work to fix the above problem: <?php class Test { public $account; public $password; } $parameters = new Test; $parameters -> account = $username; $parameters -> password = $password; try { $client = new SoapClient ("https://www.somewebsite.com/Serv­ ice.asmx?wsdl", array('classmap' => array('CheckUser' => 'Test'))); $client -> CheckUser ($parameters); echo "Valid Credentials!"; } catch (Exception $e) { echo "Error!<br />"; echo $e -> getMessage (); } ?> I modified it and my version as follows: <? class Book { public $author = "1"; public $title = "2"; public $publisher= "3"; public $loc= "4"; } $bookC = new Book; $sc = new SoapClient("URLTOWEBSERVICE?wsdl",­ array('classmap' => array('bookC ' => "Book"))); try { print_r($sc->getBook($bookC)); } catch (Exception $e) { echo $e->getMessage(); } WSDL as follows: - <s:complexType name="Book"> - <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="author" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="title" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="publisher" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="loc" type="s:string" /> </s:sequence> </s:complexType> Been stuck on it for a while, any ideas? I've also tried using nuSoap with the same result. :|
  4. $months[01] = "Jan"; $months[02] = "Feb"; $months[03] = "Mar"; $i = 02; // also tried "02" echo $months[$i]; The above code has me stumped (echos nothing). Coming from a Java background I've had no such troubles substituting array indices with variables. When i change the $i (in between the brackets) with 02 it appears to work. Any ideas?
  5. thanks alpine, i figured it out from your code.
  6. I have a drop down menu, i also have a value so when the form is loaded i want to select the drop down menu item based on the string. I tried all combinations and i just can't get it to auto select the drop down menu item based on the string (they're EXACTLY the same) any ideas?
  7. heh whoops yes it works now: [code] $a = 10/100; $b = 1000; $b = $a*$b; echo $b; [/code]
  8. i don't know why the following isn't working. I'm trying to calculate 10% of a value? [code] $a = 10/100; $b = 0; $b = $a*$b; echo $b; [/code] it just gives me 0 :|
  9. ok solution was to: [code] $sql = "INSERT INTO userinfo VALUES ('','".$user->getUserName()."')"; [/code] ???
  10. and if i pass a $user object with a username, password i can print it within the function, it works. However if i use it in the insert statement i get undefined variable: $sql = "INSERT INTO birthdays (name, birthday) VALUES ('$user->getUserName()', '$birthday')";
  11. actually i still want to use OO concepts. i still can't figure out why the original code doesn't work. If i remove the variables and insert values instead it works no problems. The funny thing is if i declare the variable locally and use it, it works.
  12. i haven't figured why i'm getting unidentified variable with the following insert statements. i mean using values work fine but as soon as i stick a variable inside the insert clause i get unidentified variable: [code] <?php include_once 'DatabaseClass.php'; class BookStoreClass extends DatabaseClass { var $name = 'hello'; var $birthday = 'hello'; function registerUser($user) { parent::connect(); mysql_query ("INSERT INTO birthdays (name, birthday) VALUES ('$name','$birthday')"); parent::close(); } } ?> [/code] Notice: Undefined variable: name in Notice: Undefined variable: birthday in
  13. As part of making my code more elegant and following an mvc pattern i want to store a query result inside a variable where i can invoke it else where besides the presentation layer. I've tried: [code] $result = mysql_fetch_array($quer); while($result) { } ends up being an endless loop. Do i need to continue to update the variable as i scroll through the rows? [/code]
  14. nerver mind, my bad :) thanks for the help.
  15. [quote author=ToonMariner link=topic=104209.msg415452#msg415452 date=1155565618] Don't! Just have a table of artist and a field for their publisher [/quote] for simplicity i have kept things in one table. i will fix the structure once i've figured this problem.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.