Jump to content

metamlmini

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

metamlmini's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yay! But now for efficiency, how do i loop through these steps? Because there will be more array_keys $filt1 = array_keys($filters); echo $filt1[0]; $filt2 = $filters[$filt1[0]]; echo $filt2[0];
  2. First of all, thanks for the quick reply! Yea i banged my head over this issue yesterday and i came across the website that you pointed at. I did some reading on the multidimensional arrays but i cant seem to figure out how i echo the high numbers that i showed. Array ( [93] => Array ( [0] => 96 ) ) I your example, how would you echo [mother] (not $row[mother], because in my case i have to work with a variable)
  3. Hi there, I will get straight to the point on this one I have a array in a variable and when i print_r the variable it shows me: Array ( [93] => Array ( [0] => 96 ) ) How do i print the 93 in the array and the 96? Both these numbers are variable so i would love to see an echo of a variable in this case. (This is all based on code not written by me and the variable structure is a mess, thats why i am asking :-)) Thanks in advance!
  4. This soap stuff is still a problem. I even did a tcpdump to see which data is being sent. I saw that de soap envelope is empty... Which is strange but if i understand correct i should use a SoapVar to preserve the input xml. Still... nothing. I hate soap! it sucks and doesnt work! Bleagh
  5. Pagination is not an option because in that case you limit using mysql. Which will not work in my case. This because not all the brands have a image (yet).
  6. Hi guys, So here is the deal. We have a list of brands that excists in a database. There are also images associated with the names. But not all the brands have images. So in the script i read if the file excists. Well this all works fine but it looks horrible. So i want to break the list in half (or limit it to 24). But i cant limit the sql query. Is there a way to "limit" a while loop and let it resume on the same page, just to change the layout (multiple collumns)? (I hope i am clear on this... i confuse even myself) $host = 'localhost'; $user = 'qwerty'; $pass = 'qwerty'; $db = 'qwerty'; $query = "SELECT * FROM ros_brands"; $result = mysql_query($query) or die(mysql_error()); $filename = "/resources/images/mm_files/" . $row['image_file_id'] . ".gif"; while($row = mysql_fetch_array($result)){ $filename = "/var/www/vhosts/test.nl/httpdocs/resources/images/mm_files/" . $row['image_file_id'] . ".gif"; if (file_exists($filename)) { echo "<a href='#'><img src='/resources/images/mm_files/" . $row['image_file_id'] . ".gif' /><span>". $row['name'] ."</span></a>"; } else { // echo "The file $filename does not exist"; } }
  7. This is not a bump. I found a work around using curl... Which is pretty ugly but it works. But now there is a new project and again with soap but this webservice doesnt allow http requests :-( and they want us to write some data in the webservice. So again, how the hell does php-soap work. the connect strings are not the problem but how do i add and retrieve data?
  8. Well i get the following: stdClass Object ( [RetrieveArticlesResult] => ) This seems to be empty, but when i try to run in it from cli: php webservice-import.php PHP Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Error writing to log file 'C:\Temp\ConnectFlowWebService.log', reason: The process cannot access the file 'C:\Temp\ConnectFlowWebService.log.tmp' because it is being used by another process. in /var/www/vhosts/test.xxx.nl/httpdocs/maintenance/webservice-import.php:13 Stack trace: #0 /var/www/vhosts/test.xxx.nl/httpdocs/maintenance/webservice-import.php(13): SoapClient->__call('RetrieveArticle...', Array) #1 /var/www/vhosts/test.xxx.nl/httpdocs/maintenance/webservice-import.php(13): SoapClient->RetrieveArticles('Article') #2 {main} thrown in /var/www/vhosts/test.xxx.nl/httpdocs/maintenance/webservice-import.php on line 13 This is weird... What gives?
  9. Hi guys! I started working on a project involving connecting to a soap server (windows). Eight hours later i am nowhere. The documentation is horrible and searching for error messages is a task that never ends. So now i am back here to ask all you guys :-) First of all, i want to connect to a external server which ends in: GatewayWebService.asmx?WSDL So i got the variable: $client = new SoapClient("http://XXXXXXXX/GatewayWebService.asmx?WSDL", array('login'=> "XXXXX",'password'=> 'XXXXXX')); And i want to do a call like: print($client->RetrieveArticles("Article")); So now i get an error: php webservice-import.php PHP Catchable fatal error: Object of class stdClass could not be converted to string in /var/www/vhosts/test.shoerama.nl/httpdocs/maintenance/webservice-import.php on line 11 But i dont think that all above is very correct. So i want to ask you guys for some help. How can i get a call with, lets say, the first 10 records from the soap server? How do i do soap call? I recieved the following "code" from the guys that host the soap server: sXml: <Parameters><timestamp>1</timestamp><branch>98</branch><pos>1</pos><languagecode></languagecode><maxitems>100</maxitems></Parameters> What do i do with this? Thanks in advance guys!
  10. I'm sorry i was kinda stressed out yesterday, the client was getting impatient so i wanted it up and running before i got to testing your script. So thanks for the stupid error i created, didnt even notice that until you said it... Now i have the time to check out your script. Alright i did some edits to check some stuff like i did in my old script and ran it. No errors occured, but the script doesnt create a array out of the file. I checked out the php.net on 'file' but the only reason i can think of is that i define a whole path in stead of only a filename... but that would be kinda crazy right? So whats the deal, no error but no output? This is the output of the file: This is the script (with edits for security reasons of course): <?php //Define input file / variabelen vastleggen $org = "/full/path/to/the/file/public_html/splash/sd-voorraad-edit.txt"; $host = 'localhost'; $user = 'username'; $pass = 'password'; $db = 'dbname'; // Debugging echo "Variablen gezet! <br />"; // Connectie met mysql $dbconnect = mysql_connect($host, $user, $pass); if (!$dbconnect) { die('Could not connect: ' . mysql_error()); } // Debugging echo 'Mysql connectie is een succes! <br />'; //Read input file into an array $data = file($org); echo $data. "<br />"; //Create temp arrays for query $barCodes = array(); $whenClauses = array(); //Process the data foreach($data as $line) { //Parse line $partRecord = explode("\t", $line); //Check that it is a valid record if(count($partRecord) != 3){ //Not a valid record, do not process //Add error handling as needed //Proceed to next record continue; } //Record appears valid, continue with processing //Remove any leading/trailing white-space in values array_map('trim', $partRecord); //Populate data array into descriptive variables // to make processing code more intuitive list($barcode, $qty, $price) = $partRecord; //Add data to temp arrays $barCodes[] = $barcode; $whenClauses[] = " WHEN {$barcode} THEN {$qty}"; } //Create the single query to update ALL records $query = "UPDATE {$db}.products SET voorraad = CASE barcode" . implode('', $whenClauses) . " END WHERE barcode IN (" . implode(',', $barCodes) . ")"; echo $query; ?>
  11. holy cr*p that is some food for thought :-) Thanks loads for explaining all this. I really want to understand all this so im not using it right away so dont think your doing it all for nothing :-). Well up next is a complaint of the client that i am not updating the price. So now im strugling because the client wants to calculate 10% off haha. So i never did that before but i tried: $prijs1 = &parts[2] / 10; <- line 62 $prijs2 = $prijs1 * 100; $prijs = number_format(prijs2, 2, ',', ''); // debugging echo $prijs. "<br />"; But this show the following error: Parse error: syntax error, unexpected '[', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/domains/public_html/splash-voorraad.php on line 62 I dont understand, how is it possible that i cant create a variable this way?
  12. Ok i will try to explain ;-) As i stated earlier there is a file that we recieve from a supplier. I read this file using above code and create a array. The variables from that array are put into the query that i state above. The select statement is a test run for an update statement. Because i want the database to be synchronised with the file that we recieve from the supplier. So if the number in the file is greater or less then the database do a update of the row "voorraad" (which means stock) In the mean time i replaced the select query with a update query "UPDATE ".$db.".products SET voorraad=".$voorraad." WHERE voorraad < ".$voorraad." AND barcode=".$parts[0].""; But this statement takes way to long. I hope that this is clear enough to work with?
  13. Ok, well that seems to be a great way to check if the array is populated. Thanks! Well this topic is going way deep in my script so im going to ask another thing :-) The array is going to be parsed into two mysql querys. 1. $q = "SELECT `barcode`, `voorraad` from ".$db.".products WHERE voorraad>".$voorraad." AND barcode=".$parts[0].""; 2. $q = "SELECT `barcode`, `voorraad` from ".$db.".products WHERE voorraad<".$voorraad." AND barcode=".$parts[0].""; But this takes a while before everything is executed. Because the same query is executed over and over again. So its not really efficient... Do you guys have any tips on this? thanks guys
  14. HA! It worked after all, sorry i am staring at this script for a while now... $string=file_get_contents("$org"); $string = rtrim($string,"\n"); file_put_contents("$f", "$string"); echo "File gecheckt op breaks <br />"; The "next line" was the problem. So this is working now :-) Thanks guys!! @mjdamato i was thinking to build such a error handling in this script but i dont know how. Well a little... I understand the theory. Later on in this script a create a array: while (!feof($file_handle) ) { $line_of_text = fgets($file_handle); $parts = explode("\t", $line_of_text); // Debugging //echo "File is uitgelezen en een array geworden! <br />"; //print $parts[0]. $parts[1]. $parts[2]. "<BR>"; I should check if $part[0] is not empty else drop entry... I dont know how to code that bit... A boost would help a whole lot :-)
  15. Thanks for the replys @Pikachu2000 Well this works fine, but this will remove all the returns from the file. Which causes some major problems in the following array. So how can i trim the return from the last line in stead of everything in the file? @Maq Hmm ok, so this horrible post will last a while longer, sorry bout that :-(
×
×
  • 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.