php

how to connect to database on another server

Hi, Could I have my php scripts on server A and connect to the MySQL database on server B? If yes, how it would be done? Thanks in advance ...

Selecting folder path using input type file

I have a problem in PHP. I am using <input type=file> to get the file name from the user. Basically I want to store the just folder path and not the file, so that when I display the path using hyperlink, the user can open the directory. But using <input type=file> the user has to select a file then only the file textbox will get fille...

how to edit specific child of xml with php

Hi this is the child of xml that i want to edit dynamically with php <items> <item xVal="SMR012" yVal="3.76" ><![CDATA[<font color = "#000000">Rating: 3.76</font>]]></item> <item xVal="SMR014" yVal="4.6" ><![CDATA[<font color = "#000000">Rating: 4.6</font>]]></item> <item xVal="SMR015" yVal="2.56" ><![CDATA[<font color =...

Running a PHP webapp from Java

I'm interested in running a PHP web application using Quercus in a way similar to: java -classpath ... com.example.LaunchPHP {php folder} All the documentation I could find on Quercus was related to running from Resin, but this is something I want as simple as possible, for running from a CI build. What possibilities are there? ...

Consuming JSON object in PHP, sent from jQuery

Hi all, I'm sending a JSON object to PHP using jQuery via $.ajax({ url: myURL, type: 'POST', contentType: "application/json; charset=utf-8", data: myData, processData: false, dataType: 'html', async: false, success: function(html) { window.console.log(html); } }); and trying to decode t...

imap_open mbox windows

Hello Everyone, I'm hoping to use mailhandler on drupal to suck in an mbox into a fourm. However, I keep getting the following errors: warning: imap_open() [function.imap-open]: Couldn't open stream in C:\wamp\www\ngl-drupal\modules\mailhandler\mailhandler.module on line 188. warning: imap_close(): supplied argument is not a valid ima...

Php - simple insert into array at a specified place

array: A-B-C-D-E-F J is the son of C. update array so: A-B-C-J-D-E-F how do I insert J after C in the array? I also map the array in a loop (array of comments for display). Will this method take a very long time to perform? ...

Replacing // comments with /* comments */ in PHP

Hi, I'm creating a CSS generator in PHP which uses CSSX (yep, they are my idea) files (with a special syntax). One feature is 'short comments': body { font-family: Georgia; //I really like this font! } Now I want to replace this comment with a /* ... */ comment, so the output is like this: body { font-family: Georgia; /*I re...

IIS 7 and FastCGI Problem

Today I was configuring IIS 7 with FastFGI in Windows 7. I followed all the steps but I get the following error: C:\php\php-cgi.exe - The FastCGI process exited unexpectedly IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which ...

Magento - Layered Nav Refresh Timeout - Cron Issue - Prices Disappear

Hello This is a problem for certain Magento users. The cron is supposed to refresh the layered navigation and sometimes it times out. When it does so, the prices will disappear for products that require computed prices. Grouped products for example, have to find the cheapest product under the group and display it. This stops working due...

Is there an algorithm to find unique combinations of 2 lists? 5 lists?

I have N Lists I'd like to find unique combinations of. I've written it out on my whiteboard and it all seems to have a pattern, I just haven't found it yet. I feel I can express a brute-force method and that will certainly be something I pursue. Is there an alternative? Would a different data structure (binary tree?) make a job like thi...

PHP - Convert a multidimensional array to string?

Hi, I'm working on a small ajax application and need to see if the values being generated in the background are what is expected. The value returned by the quest can be quite a complex multidimensional array, is there a way to convert this into a string so that it can be shown with alert? Is there any other way of seeing these values? ...

Loader.php trying to load Doctrine classes, but we use Propel!

We are finding cases where we get the following 500 error: File xyz.php does not exist or class "xyz" was not found in the file at () in SF_ROOT_DIR/lib/vendor/Zend/Loader.php line 107 ... where xyz == Memcache (when trying to use symfony cc on the command line) or sfDoctrineAdminGenerator (when using an old-ish AdminGenerator-g...

Check a field in MySql from a php md5 string

hello all! I'm trying to validate a pair of data columns on mysql from my php page across md5 function. I've encrypted the string "helloworld" with php md5 function and attempted to compare it with MYSQL MD5 function but it won't work. I do this because in the database there is a pair of strings "hello" and "world" needs to be compared w...

retrieving $_GET variable in jquery

I have a main page (topic.php) with GET information in the URL, like this: http://studio.byuipt.net/topic.php?topic=Debugger&amp;desc=Helps%20find%20and%20solve%20problems%20with%20others%27%20code. I have a div, "currLeader" in topic.php into which I load another page, getCurrLeader.php. getCurrLeader.php is supposed to use the topic...

Get values from controller to form

Hi there, I'm using the PHP Zend Framework. How can I get the values from the controller sent by: $infoForm=array( // I get these values from a DB 'idCity' => $idCity , 'idRestaurant'=>$idRestaurant ); $form->populate($infoForm); i get the info in the Dojo_Form $city = new Zend_Dojo_Form_Element_FilteringSel...

Facebook app shows a blank page

Hello, Im trying to learn about creating applications for Facebook using PHP . I created a simple hello world app,named myapp,using php. I have registered the app on facebook and also hosted the facebook php client client library on the server hosting my app. But when i go to http://apps.facebook.com/myapp/, i get a blank page. Any way ...

PHP Conditional Followed by Closing Tag

I am kind of confused about how the below code works. In my head I am imagining each php block being executed as a whole and rendered to HTML. The fact that the first block is kind of incomplete with a hanging brace doesn't play nicely with how I imagine PHP to work. What does the PHP module do when it gets to a PHP closing tag? How ...

Getting headers when streaming images through PHP from a database

I have some pretty simple php code that returns binary image data from a database. ob_start(); $stmt = $db->prepare($sql); $stmt->execute(array($ImageID)); $stmt->bindColumn(1, $lob, PDO::PARAM_LOB); $stmt->fetch(PDO::FETCH_BOUND); ob_clean(); header("Content-Type: " . $content_type); fpassthru($lob); Let's call this script get_ima...

basic question in foreach in php

Hi, basically if I have a string like this: $str = \data1\data2\data3\data_tmp\file.pgp can anyone tell me how to get the last part 'file.pgp'? TIA. ...