Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 49/1708 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • How to generate multiple levels with GraphViz (Image_Graphviz interface for PHP)

    - by ropstah
    Hi, i'm trying to generate the following diagram using Image_GraphViz for PEAR. However It only shows a top-level node (with the text "0") and childnodes "1", "2", "3" and "4" directly under the top-node. Am I missing something? This is the code: $gv = new Image_GraphViz(true); $gv->addEdge(array('1', '2')); $gv->addEdge(array('2', '3')); $gv->addEdge(array('2', '4')); $gv->addEdge(array('3', '5')); $gv->addEdge(array('3', '6')); $gv->addEdge(array('3', '7')); $gv->addEdge(array('4', '5')); echo $gv->fetch('svg'); I tried the following, but this is obviously wrong :). $gv->addEdge(array('1', '2')); $gv->addEdge(array('1', '2', '3')); $gv->addEdge(array('1', '2', '4')); $gv->addEdge(array('1', '2', '3', '5')); $gv->addEdge(array('1', '2', '3', '6')); $gv->addEdge(array('1', '2', '3', '7')); $gv->addEdge(array('1', '2', '4', '5')); I understand there are two ways to get to 5. Through (1, 2, 3, 5) and/or (1, 2, 4, 5). The image should just show two lines going to 5. I'm very confused, any suggestions?

    Read the article

  • Getting duplicate key values in array

    - by WmasterJ
    For some reason when trying to populate an array I am not getting the desired result. In the first part I create an array of arrays, the key of each has a name such as "Biology Education". But when I then populate that same array it doesn't for some reason use the same array element but a new one. So part 1 results in an array with 13 array elements (empty). After part 2 has run the array has 26 array elements, with the first 13 empty and the other 13 populated as wanted. The reason why I want to work is that the first 13 array elements are sorted. The last 13 are jumbled. Why is this happening and how can I correct it? // PART 1 // Create array of research areas $research_result = db_fetch_array($research['research_query_result']); $research['areas'] = explode("\n", $research_result['options']); // Put the values as key and every key the new value of an array object $research['areas'] = array_fill_keys($research['areas'], array()); // PART 2 foreach($research['user'] as $uid => &$user_object) { $user_object->profile_research_areas = explode(", ", $user_object->profile_research_areas); foreach($user_object->profile_research_areas as $key => $area) { $research['areas'][$area][] = $uid; } }

    Read the article

  • echo POST array.. or other ideas?

    - by gamerzfuse
    Update: As seen in the Original Questions below, I am looking to echo an array. The problem is that when I send the Moneris gateway to return a POST array to my new file (cart.php) it gets a 500 Internal Server Error. This is the same error I received when it send to the script, which should have worked. Is there any reason that it would always send a 500 Internal Server Error? Cart.php Direct Link Craig ORIGINAL QUESTION: Hello there, I am back for another question. Here is my dilemma: I have a script (ImageFolio Commerce) that hasn't been updated on our server since.. probably 2003. The script had a Payment Gateway (Moneris) manually added to it by the company who offers the script. This costs $1000 to get them to add a gateway. I now have a new client who purchased this business from the previous owner. While switching the account to the new owner's Moneris account, we found out that things have been updated. Long story short.. The Moneris gateway can send 3 types of responses: POST with XML Data POST GET I imagine it is easiest to just use the POST array. I have the file that it sends the response to. As of now the file responds with a Internal Server error, but it does process the order. What I want to do is determine what the POST array is that is being sent, so that I can take it and echo it in a logical manner. Is there a way to capture and echo the entire POST? Or can someone suggest a better method of doing this? Thank you, Craig

    Read the article

  • php (rar) i want to rar a folder using rar on Ubuntu (linux) by php (on dedi server) noob

    - by Steve
    hey guyz i want rar (not tar) my folder on my server by using php RAR RAR 3.93 Copyright (c) 1993-2010 Alexander Roshal 15 Mar 2010 Registered to my real name OS Ubuntu Release (Karmic) kernel linux 2.6.32.2-xxxx-grs-ipv4-32 Gnome 2.28.1 latest php an lighthttpd i have tried these things http://php.net/manual/en/function.escapeshellarg.php // may be wrong code http://php.net/manual/en/function.exec.php http://php.net/manual/en/function.shell-exec.php my command (working in ssh and nautilus script) rar a -m0 /where/file/will/saved/file_name.rar /location/ti/data/dir/datafolder php code $log=Shell_exec("rar a -m0 /where/file/will/saved/file_name.rar /location/ti/data/dir/datafolder"); echo $log; one method is left which i don't know how to use and its working on server that is by somefile_to_execute_command.sh i have to execute .sh file from php need to send some variables (command) and i tried this method can rar file with a script named RapidLeech but its rar from only its own files dir only :( but i want to do in different directories. Rapid Leech rar class http://paste2.org/p/791668 i m able run shell command with php (cp(copy),mv(move),ls(directory list),rm(remove aka delete)) but got failed to run rar i gives no output i also tried to given path rar and i used alot commands with php Shell_exec function and working like they work with ssh and i have tried almost 80 % method given on net and failed from last 3days i m over now plz help me i need php script file working plz reply if u have any info n code and experience about rar and this kinda :( problem i m 99% noob just used code mean search Google collect script make my own working thing (for personal use only) n now i m failed to rar folder and file :(( now plz provide me code plz don't talk in technical language because i m just reading my first php book (for dummies :D) mean noob and 0.1 plz help me as much u can thankx

    Read the article

  • PHP, MySQL: mysql substitute for php in_array function

    - by Devner
    Hi all, Say if I have an array and I want to check if an element is a part of that array, I can go ahead and use in_array( needle, haystack ) to determine the results. I am trying to see the PHP equivalent of this for my purpose. Now you might have an instant answer for me and you might be tempted to say "Use IN". Yes, I can use IN, but that's not fetching the desired results. Let me explain with an example: I have a column called "pets" in DB table. For a record, it has a value: Cat, dog, Camel (Yes, the column data is a comma separated value). Consider that this row has an id of 1. Now I have a form where I can enter the value in the form input and use that value check against the value in the DB. So say I enter the following comma separated value in the form input: CAT, camel (yes, CAT is uppercase & intentional as some users tend to enter it that way). Now when I enter the above info in the form input and submit, I can collect the POST'ed info and use the following query: $search = $_POST['pets']; $sql = "SELECT id FROM table WHERE pets IN ('$search') "; The above query is not fetching me the row that already exists in the DB (remember the record which has Cat, dog, Camel as the value for the pets column?). I am trying to get the records to act as a superset and the values from the form input as subsets. So in this case I am expecting the id value to show up as the values exist in the column, but this is not happending. Now say if I enter just CAT as the form input and perform the search, it should show me the ID 1 row. Now say if I enter just camel, cAT as the form input and perform the search, it should show me the ID 1 row. How can I achieve the above? Thank you.

    Read the article

  • Add items from one array to another

    - by Peterim
    I have two arrays: 1) The first array: array( [0] => array( [code] => code_1 [value] => xxx [1] => array( [code] => code_2 [value] => xxx [2] => array( [code] => code_3 [value] => xxx 2) The second array: array( [0] => array( [settingcode] => code_1 [value] => xxx [1] => array( [settingcode] => code_2 [value] => xxx [2] => array( [settingcode] => code_3 [value] => xxx [3] => array( [settingcode] => code_4 [value] => xxx [4] => array( [settingcode] => code_5 [value] => xxx How can add two missing items (code_4 and code_5) from array2 to array1? Thank you!

    Read the article

  • How do I count how many arrays have the same name within a multidimensional array with php?

    - by zeckdude
    I have a multidimensional array, and I would have multiple arrays within it. Some of those arrays contain multiple arrays within them as well, and I would like to count how many arrays are within the second array(the date). This is an example of the structure of the multidimensional array: $_SESSION['final_shipping'][04/03/2010][book] $_SESSION['final_shipping'][04/12/2010][magazine] $_SESSION['final_shipping'][04/12/2010][cd] This is the foreach statement I am currently using to count how many of the second array(the one with the dates) exists. foreach($_SESSION['final_shipping'] as $date_key => $date_value) { foreach ($date_value as $product_key => $product_value) { echo 'There are ' . count($date_key) . ' of the ' . $date_key . ' selection.<br/>'; } } It is currently outputting this: There are 1 of the 04/03/2010 selection. There are 1 of the 04/12/2010 selection. There are 1 of the 04/12/2010 selection. I would like it to output this: There are 1 of the 04/03/2010 selection. There are 2 of the 04/12/2010 selection.

    Read the article

  • Why is PHP discriminating between .php and .abc extensions for caching?

    - by Sam
    There seems to be a problem between how PHP engine handles identical files that differ only in their file extension. Problem: "An If-Modified-Since conditional request returned the full content unchanged." Also, I measured that the .php extension loads much faster than identitcal twin with .xxx extension even though the file contents are identical, and they differ only in their file extension. "HTTP allows clients to make conditional requests to see if a copy that they hold is still valid. Since this response has a Last-Modified header, clients should be able to use an If-Modified-Since request header for validation. RED has done this and found that the resource sends a full response even though it hadn't changed, indicating that it doesn't support Last-Modified validation." homepage ending with .php exact same file, but ending .ast Given: A home.php file is copied as home.xxx and this extension is added to htaccess to recognize it as a PHP file. The .php file listen to the php.ini where freshness is set to 3 hrs, the non .php files have to listen to htaccess where freshness is set to 2 hrs according to: AddType application/x-httpd-php .php .ast .abc .xxx .etc <IfModule mod_headers.c> ExpiresActive On ExpiresDefault M2419200 Header unset ETag FileETag None Header unset Pragma Header set Cache-Control "max-age=2419200" ##### DYNAMIC PAGES <FilesMatch "\\.(ast|php|abc|xxx)$"> ExpiresDefault M7200 Header set Cache-Control "public, max-age=7200" </FilesMatch> </IfModule> So far so good and everything loads, except, the non-php file doesn't cache properly, or it does cache well but doesn't validate well, to be more specific. See images enclosed. Only the non-php file extension causes the error and loads slower. The entire page.php loads faster as somehow all the elements in there then load properly from cache, while the page.abc has the full request returned while it ought to be cached, meaning the entire page is slower. Bottom line: What should be changed, in order eliminate the If-Modified-Since conditional request returning the full content unchanged?

    Read the article

  • Which PHP MVC Framework should I use with MongoDB?

    - by Justin Jenkins
    I have a number of smaller scale PHP projects lined up and would like to take advangtage of a framework. I've read these questions ... What PHP framework would you choose for a new application and why? Picking a PHP MVC Framework I found them useful but I need more specific opinions; here are my major requirements ... MongoDB support (the more 'built-in' the better, a full ORM is not needed however.) MVC (and nice pretty urls ... if you will ... too!) Must work on Apache (2.2) on Ubuntu (10.04.1 LTS), but nginx is also a nice plus. PHP 5.3 or greater. Nice to haves ... I'd prefer more readable code than lots of "shortcut" shorthand coding (that just ends up confusing me later.) I've used PHP for a number of years, but don't use a lot of it's OO (nor do I really care to.) I really love jQuery, so a framework that "thinks" the same way would be nice. Lightweight, I don't need a ton of features ... I just need to make my life easier. I've briefly looked at Lithium, CakePHP, Vork and Symfony ... What would be the best framework for my needs? EDIT: Also docs are pretty important, documentaction with examples! I can't stand to waste time figuring how to use a framework if it would have taken less time to code it myself.

    Read the article

  • PHP - advice for java HashMap alternative in php?

    - by teutara
    I know it is super noob and will be answered in no time, but I could not figure.. sorry for any inconvenience.. Here is the thing: ID colA colB Length 1 seq1 seq11 1 2 seq1 seq11 11 3 seq3 seq33 21 4 seq3 seq33 14 I have a db with this kind of a table, has more than 10M rows. I want to loop though colA first, get the relevant colB value, and check if there are any other occurrences of the same value. For example in colB (seq11) there are 2 occurrences of colA(seq1), this time I have to combine those and output the sum of the length. Similar to this: ID colA colB Length 1 seq1 seq11 12 2 seq3 seq33 35 I am a bit java guy, but because my colleague has written everything in php and this will be just an adding, i need a php solution. With java i would have used hashmap, so that I would have the colA data once and just increment the value of "Length Column".. I know it is not a proper question, but.. Thank you in advance.. $$$$$$$$$$ EDIT $$$$$$$$$$ I tried this query in order to group by occurences: SELECT COUNT(*) SeqName FROM SeqTable GROUP BY SeqName HAVING COUNT(*)>0;

    Read the article

  • how can I get around no arrays as class constants in php?

    - by user151841
    I have a class with a static method. There is an array to check that a string argument passed is a member of a set. But, with the static method, I can't reference the class property in an uninstantiated class, nor can I have an array as a class constant. I suppose I could hard code the array in the static method, but then if I need to change it, I'd have to remember to change it in two places. I'd like to avoid this.

    Read the article

  • Help regrouping an array

    - by jim
    I'd like to regroup my array. I have the following: Array ( [0] => Array ( [name] => test1 [item_id] => 1 [category] => cat1 ) [1] => Array ( [name] => test2 [item_id] => 2 [category] => cat1 ) [2] => Array ( [name] => test3 [item_id] => 3 [category] => cat1 ) [3] => Array ( [name] => test4 [item_id] => 4 [category] => cat2 ) ) I'd like to regroup it like this: Array ( [cat1] => Array ( [0] => Array ( [name] => test1 [item_id] => 1 ) [1] => Array ( [name] => test2 [item_id] => 2 ) [2] => Array ( [name] => test3 [item_id] => 3 ) ) [cat2] => Array ( [name] => test4 [item_id] => 4 ) ) Can someone tell me how this is best done?

    Read the article

  • Changing key of Multidimensional array in PHP

    - by Thyu
    This is my first array Array ( [0] => Array ( [0] => 1 [1] => Elite [2] => Air-Con Bus [3] => Monday ) [1] => Array ( [0] => 4 [1] => KBZ [2] => Airplane [3] => Wednesday ) [2] => Array ( [0] => 5 [1] => Yoma [2] => Cruise [3] => Tuesday ) ) I want to be inner array[0] to the outer array key. Like the following array: Can I or not? Please suggest me. Array( [1] => Array ( [0] => 1 [1] => Elite [2] => Air-Con Bus [3] => Monday ) [4] => Array ( [0] => 4 [1] => KBZ [2] => Airplane [3] => Wednesday ) [5] => Array ( [0] => 5 [1] => Yoma [2] => Cruise [3] => Tuesday ) )

    Read the article

  • MySQL Execution Time Spikes

    - by Brett
    I am having issues with MySQL all of the sudden today. Details: OS: CentOS release 5.7 Server type: Parallels virtuozzo container running on mediatemple DV 4.0 package Average total memory usage: <500mb Total memory usage allowed: 1gb (part of shared pool for emergency only, users are only guaranteed 500mb) Processor: 1ghz Main database sizes with most usage: 275mb & 107mb server stack: nginx 1.0.10, mysql 5.1.54, php 5.3.8 with php-fpm innodb_buffer_pool_size=100M php-fpm max children: 5 Webapps: custom php-based sites, magento & drupal slow query timeout is set to 1 second Steps I completed towards diagnosis: Cannot restart container yet - I will try later tonight when our domestic traffic has dropped Enabled mysql and php-fpm slowlog. Found functions that did DB queries in php-fpm slowlog were taking over 1s to complete at times Found some simple queries in mysql slowlog taking well over 1s to complete that should take less than 1s. Most interesting - execution time seems to spike at times. A query will take .2s a couple times, then one time it will take 8s to run the same query. These results were verified by running raw SQL queries through mysql command line. Top does not reveal anything too interesting Only resource related thing i can see is load averages much higher than normal Up until today, mysql has been fine, there have been no major changes to the db since yesterday. Sometimes things are so bad, I am seeing bad gateway errors after 60s of execution time. Innodb is doing on average 300-1400 reads/sec. Mysql is doing 3-10 queries/sec slow query count in 2 hours uptime is 171 (with slow timeout at 1 second) Tried restarting mysql, nginx, php-fpm multiple times For example: UPDATE `catalogsearch_query` SET `query_text` = 'EW 90', `num_results` = '7532', `popularity` = '99180', `redirect` = NULL, `synonym_for` = NULL, `store_id` = '1', `display_in_terms` = '1', `is_active` = '1', `is_processed` = '1', `updated_at` = '2012-05-08 21:38:31' WHERE (query_id='31'); This query took 17sec to complete one time, rest of the time around .079 sec. But varies, sometimes 1sec, sometimes .004 sec. This is running the same query, over and over with a couple seconds time in between each. Most tables are innodb, and sometimes I noticed the lock time taking 90% of the query execution time, but most of the time lock time is insignificant. Any idea what's going on here?

    Read the article

  • Build tools for php, html, css, js web app development

    - by cs_brandt
    What are some recommendations for a build tool that would allow me to upload changes to a web server or a repository and minify the js and css automatically, and possibly even run Closure compiler on the JavaScript? Im not worried about doing anything with the php code other than update with most recent changes although in the future would like to have phpdoc updated automatically. Just wondering if there is some way to do all this other than an amalgam of scripts that run or have to be invoked every time. Thanks.

    Read the article

  • Installing APC on lighttpd + php 5.2 on Ubuntu 10

    - by Patrick
    I've found the following tutorial to install APC on servers with lighttpd + php 5.2 on Ubuntu 10: http://www.assembla.com/wiki/show/socialinguatribe/Integrating_APC_Into_PHP5_And_Lighttpd However, when I run "sudo pecl install apc" the package is just downloaded and is not installed. (i.e. I'm not asked the next question" and apc.ini file is not created at all. If I run only "pecl install apc" I get a warning (no permissions to write some files). thanks

    Read the article

  • Add extensions of php-libvirt to xampp server

    - by Alee
    I am trying to compile and install php-libvirt extensions to xampp server. For this I followed: http://enblog.pahans.com/2010/08/installing-phplibvirt-with-debian-5-0-lenny/ I am using Ubuntu 11.10. During the compilation and installation I got no errors. After completing all the steps when I start /opt/lampp/lampp start, all services started without any error. But when I check libvirt in phpinfo() it shows: Please help me out... Thanks

    Read the article

  • PHP framework suggestions

    - by user1104791
    I'm going to be creating a site for a business with the following: Single Item purchases with Paypal, Google Checkout and Amazon Checkout Digital Downloads for members from a CDN Forum Voting on different items While that seems rather simple having to deal with the three different payment gateways is a big pain in the ass. Django has a great payment library which works for all three but I'm not able to find one for any of the PHP frameworks. Anyone have any suggestions? I'm posting here as suggested by someone at Stackoverflow.

    Read the article

  • PHP-FPM - Nginx - phpMyAdmin - 502 bad gateway

    - by Jesse
    I have installed and configured PHP-FPM, Nginx, and then phpMyAdmin. When I access the main site everything works fine but as soon as I go to http://mysite.com/phpmyadmin I get a 502 bad gateway error. When I look in my error logs I see the following error repeated throughout: (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx Here is my default.conf for nginx: http://pastebin.com/YFEvAw81 I have tried many different configurations that I have found from users that have had the same issue but can't seem to get any of them to work.

    Read the article

  • Synchronise Database between servers via php [closed]

    - by Emmanuel
    Hi Guys, I'm needing to synchronise two mysql databases between different servers on a regular basis, by a client-initiated interface. I've been doing it by remote MYSQL connection, and adding the IP of the servers to the whitelist for MYSQL remote connections. Problem is however, that the client has a dynamic IP, so as soon as it changes they can no longer sync. So I'm trying to find an alternative way of synchronising the two databases via some sort of secure php script.

    Read the article

  • Witchcraft! Php [migrated]

    - by Steve Green
    This is madness, hoping someone can explain. $dir = getcwd(); $a = "/bla/httpdocs/ble"; $b = "/bla/httpdocs/meh"; if( ($dir == $a) || ($dir == $b) ){ $dirlist = glob("../images2/spinner/*.jpg"); }else{ $dirlist = glob("images2/spinner/*.jpg"); } works fine but $dir = getcwd(); if( ($dir == "/bla/httpdocs/ble") || ($dir == "/bla/httpdocs/meh") ){ $dirlist = glob("../images2/spinner/*.jpg"); }else{ $dirlist = glob("images2/spinner/*.jpg"); } doesn't. (By doesn't work I mean it returns false, I also tried === ) Wondered if strings were being null terminated so tried: print_r(str_split($a)); //$a has been set to the string below for this. print_r(str_split("/bla/httpdocs/ble")); they returned identical arrays Array ( [0] => / [1] => b [2] => l [3] => a [4] => / [5] => h [6] => t [7] => t [8] => p [9] => d [10] => o [11] => c [12] => s [13] => / [14] => b [15] => l [16] => e ) Array ( [0] => / [1] => b [2] => l [3] => a [4] => / [5] => h [6] => t [7] => t [8] => p [9] => d [10] => o [11] => c [12] => s [13] => / [14] => b [15] => l [16] => e ) Anyone?

    Read the article

  • Turn-around time in PHP

    - by user73409
    Is there any one who had tried to build/convert a php version of the Excel method in computing Turn-around time(excluding holidays, weekends and non-business hours)? Excel Turn-around Time Computation: =(NETWORKDAYS(A2,B2,H$1:H$10)-1)*("17:00"-"8:00")+IF(NETWORKDAYS(B2,B2,H$1:H$10),MEDIAN(MOD(B2,1),"17:00","8:00"),"17:00")-MEDIAN(NETWORKDAYS(A2,A2,H$1:H$10)*MOD(A2,1),"17:00","8:00") :REF-URL[http://www.mrexcel.com/forum/excel-questions/514097-i-need-formual-calculate-turn-around-time.html] Thanks.

    Read the article

  • Shopping cart PHP framework

    - by Ranjit Pradhan
    I am going to build a new shopping cart project for my client and I have a little confusion about shopping cart framework in php. I have read about more shopping cart framework, but I can't get the right way to use a perfect framework for my project. The requirement of the project is: Inventory management Authorization UPS shipping integration Please anyone help me out to choose the right frame work and start my project as soon as possible.

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >