php

PHP XML: How to display XML with PHP

How would i retrieve what is inside these XML tags in php? I can get it to work when they don't have a ':' inside the tags. But for this, it doesn't seem to work: $description = $item->getElementsByTagName('desc'); $description = $description->item(0)->firstChild->nodeValue; <sql:time>21:00</sql:time> <sql:event> Empty </sql:event> <...

var transfert between php and javascript

I like to get a dir listing in php glob("*.jpg"); or $dir = '.'; //requested directory to read $notthat = array('.', '..'); //what not to include $listedfiles = array_diff(scandir($dir), $notthat); // removed what not to include so i like to send that array to a javascript like that (slides = $listedfiles) function startSlide...

Zend Pagination with array

I'm currently using ezSQL, which I believe to be a great SQL wrapper. I've been tasked with adding in pagination that we can just drop in. Zend has one, which seems like it should work, as it's loosely coupled with the rest of Zend. I'm returning an array with ezSQL, ala: $results = $db->get_results("SELECT * FROM table", ARRAY_A); ...

Apache mod_rewrite and PHP GET Arrays

I want to have a url like http://localhost/folder1/folder2/folder3/file Then i want mod_rewrite to convert it to $_GET['d'] in the url it would look like d[]=folder1&d[]=folder2&d[]=folder3 Is this possible? Thank You. ...

CodeIgniter: Simple URL routing question

I'm new to CI and URI routing in general. I created a new app. Set the default controller to Main. In Main, I have an index method, a popular method and a recent method. When I load my app, the url shows up as http://localhost/myapp... this obviously loads up the index method in the Main controller... that's fine. Now how do I route m...

The Script Path of an included PHP script?

Is there a way to achieve the following? In my /www/var/public_html/index.php file i have this <?php include('database/connect.php'); ?> And then in /www/var/public_html/database/connect.php, I want to do something like this <?php $my_path = get_path_of_current_script(); // should not be path of index.php echo $my_path; // should p...

Split Column with MySQL

Hello, I recently took over a project that has a pretty dirty database... The table "users" has a "phone" column... The problem is that the column holds multiple phone numbers separated by "/". I would like to put all of these in separate columns (phone 1, phone2, phone3 etc) But have no idea what the best way to do it is. Is it possibl...

Matching numbers that aren't prices

I am trying to replace all numbers except for prices (numbers starting with $) with X in a body of text. I've been trying to use a look behind to get the job done, but it doesn't seem to work. Here is what I am using now: $comments = preg_replace("/(?<!$)([0-9]+)/", "x", $comments); This ends up just replacing all numbers with X inc...

How should I move my code from dev to production?

I have created a PHP web-application. I have 3 environments: DEV, TEST, PROD. What's a good tool / business practice for me to move my PHP web-application code from DEV to TEST to the PROD environment? Realizing that my TEST environment still only connects to my TEST database; whereas, I need to PROD environment to connect to my PROD...

Consume AMF methods without Flash

I have to call an existing AMF Method in a PHP (or Perl) Script and read its results. Is it possible to use amfphp to invoke it instead of serving AMFs? or use other tool? Am I trapped to use Flash? Thank you ...

Alternative to Many Eyes Bubble Chart

I am looking for a suitable package (free or otherwise) to duplicate the functionality (mainly in visual department) of IBM's Many Eyes Visualizations Bubble Chart in our app. Below attached a screenshot of what I am talking about. Ideally it does the following: Renders with ether flash or javascript. Ability to generate graphs at leas...

Access an Array Returned by a Function

Is there anyway to directly access the data returned in an array without a temporary variable? Currently, my code is as follows: function getData($id) { // mysql query return mysql_fetch_array($result); } $data = getData($id); echo $data['name']; Is there a direct way to get the returned data without the temporary variable? ...

content from divs into textarea

...

editing values stored in each subarray of an array

I am using the following code which lets me navigate to a particular array line, and subarray line and change its value. What i need to do however, is change the first column of all rows to BLANK or NULL, or clear them out. How can i change the code below to accomplish this? <?php $row = $_GET['row']; $nfv = $_GET['value']; $col = $_G...

secure and efficient file uploader

I am looking for a decent file uploader. I'm using django, but while i don't NEED a django file uploader, python is preferable. php would also be fine. can anyone point me in the direction of a good file uploader which is secure and efficient? EDIT: I need the server-side handler of file uploads. ...

Zend Framework app not closing mysql connections properly

I'm having a weird issue using Zend_Db's PDO adapter for managing my database connections. All of a sudden, I'm constantly hitting the connection limit on my MySQL server. For whatever reason, every three or four hours or so I end up getting this error, and Apache craps out on every HTTP request with this error: PHP Fatal error: Un...

Have a delete button exaclty where I want it....

and it's linked to a 'confirm comment deleted page. Ideally I would like it to just become erased and have the page reload with it gone, and then send it to my db marked as dead. Basically, users have a profile which allows other users to make comments.With the help of PHP I would like to be able to have the delete button only show up ...

Commercializing a php application?

Say I have developed a php webapp and would like to distribute it for others to use as proprietary software. Is there anything I can do short of some sort of licence or just trusting the customer to avoid having to provide a hosted solution? Clearly if I just distribute the application to paying customers to host independently, I run t...

Features needed when building a ORM with PHP?

I have never really appreciated ORM's so I think that the only way to remedy this is to build a basic one myself so I can see what all the hubbub is. So with that in mind, what are the basic features I would need to include to make a semi-usable ORM? As far as I can tell, it would basically need to work like this for the end programmer:...

Is it possible to iterate over a multi-dimensional array in smarty?

Can someone provide a simple demo? I can't seem to get my head around the smarty syntax for iterating over an array that looks like the one below. I want to get at values at all levels. Array ( [0] => Array ( [id] => 0 [name] => 12312 [sub24] => Array ( ...