php

Getting actual value from PHP SimpleXML node

Hey guys, $value = $simpleXmlDoc->SomeNode->InnerNode; actually assigns a simplexml object to $value instead of the actual value of InnerNode. If I do: $value = $simpleXmlDoc->SomeNode->InnerNode . "\n"; I get the value. Anyway of getting the actual value without the clumsy looking . "\n"? ...

Can anyone help me with the PHP Chart ?

I am trying to display Total Order Amount Per Day in the Present Month. $sql = "SELECT date(order_placed_date), COUNT(order_id), SUM(order_total) AS order_total FROM orders WHERE order_placed_date>=date_sub(current_date, INTERVAL 31 DAY) GROUP BY date(order_placed_date)"; if (!...

AMFPHP vs ZendAMF

Is one 'better' than the other? Doubt that since as I understand both are written by the same author, only Adobe 'officially' supports Zend. My application is composed of 3 parts 1-an image editing tool allowing users to upload images, edit them, then post them to a server. 2-a publicly viewable gallery 3-a private 'admin' tool allowing...

How can I attach a file with a PHP cURL XML Call

I'm using the Amazon AIMS API to upload a an inventory file and I'm having an issue with the cURL call to upload the file. The documentation is very limited, so there is no example code that helps out in this. This is what I have so far of the cURL call: // $FILENAME is filename of the CSV file being uploaded: $inventory = fopen($FILE...

can you begin a mysql statement with "IF"?

I am trying to implement "IF record EXISTS THEN UPDATE ELSE INSERT" in mysql. Specifically, I have to figure out how to do that with Doctrine ORM. One solution using native MySql is to use "ON DUPLICATE KEY UPDATE". This is unfortunately not supported in Doctrine. Another semi solution is to use "REPLACE INTO" syntax. Doctrine sup...

PHP dynamic multidimensional array or objects

Hi, I'm trying to create a recursive function (or method) that stores a sub-tiered navigation in an array variable or object. Here is what I have: class Navigation extends Database { function build($parent_id = 0) { $query = 'SELECT id, name, href, parent_id FROM navigation WHERE parent_id = '.$parent_id.' ...

How to load openssl.so dynamic library in PHP 5.2.1

Hello, I recently installed MAMP version 1.6 on my MAC OS 10.5.7. Now I am running a script to connect to a site using ssl. After some research, I added the following line to my php.ini(under the extensions part) extension=openssl.so However When I reestart my Apache server I get this Warning: [15-Jul-2009 16:30:39] PHP Warning: PH...

Cake PHP plugin/img/ diectory throws missing method instead of 404

I have a Cake PHP plugin that I have written. The plugin has its own controller so that it can serve up some dynamic code on the plugin's index page (/keyedit/ or /keyedit/index). When images are requested from /keyedit/img/ they are served up properly. But if the image doesn't exist Cake thinks the /img/ is a method in the keyedit_cont...

In search of Module Web Design architecture

Hi All, I'm designing a large web application and I would like to finally be able to modularize the different elements on the page. I'm using the Zend Framework. I would like to create independent modules that I can combine to create a page(e.g. Contact box, Search Box, Latest blog comments...), sort of how Drupal would do it. These ...

Problem with an iCalendar Feed

Hi, I'm outputting my iCalendar feed via PHP and it seems to work fine validation wise and when importing into iCal on the mac and windows calendar on vista however Google calendar throws it out completely... www.wheresthegeeks.co.uk/calendar/ical can anyone have a gander and give me some suggestion to see whats wrong? thanks a lot D...

How do I access another MySQL Database from another IP Address with PHP?

Ok, If you can answer this question, you deserve the nobel peace prize. Anyways, here's the situation. I'm using Slicehost dot net, and I have 2 slices (two different IPs). One slice is my mail server and the other is my normal website. I'm running Ubuntu (8.04 or 8.10, something like that, it shouldn't matter). What I'm trying to do is...

Codeigniter vs Ruby on Rails

I'm new to development, and I'm getting into it as a hobby. (currently a student). I'm wondering what you guys and girls advise. There's greater support for PHP, I realize. But Ruby looks like it offers a great deal more flexibility...and it's prettier. This is a question from a noob, so if this is a bad question, please excuse me! ...

upload images in php

ho everyone i am trying to upload images but i got a warning that i didn't understand here is the code // print out contents of $_FILES ARRAY print "Print out of the array of files: FILES <br>"; print_r($_FILES); print "<br><br>"; $F1 = $_FILES["fname"]; print_r($F1); print "<br><br>"; // 0 means a successful transfer if ($_...

Is there a better way to get old data?

Say you've got a database like this: books ----- id name And you wanted to get the total number of books in the database, easiest possible sql: "select count(id) from books" But now you want to get the total number of books last month... Edit: but some of the books have been deleted from the table since last month Well obv...

How to get extra error information from PHP's mail() failure?

When mail() fails, there not much info about what went wrong. I understand that the best course of action is to check your sendmail logs, or whatever mailer has PHP used. But from a programming and pragmatic, point of view: on a Linux hosted environment, what can a PHP program do to get as much extra info to properly log the failure, pro...

In php, how do logical operators work _with non-booleans_?

In other programming languages (Python, Ruby, Scheme), I'm used to doing things like $foo = $cat && $dog; $bar = $fruit || $vegetable; I would expect that $foo would get assigned to $dog if $cat were null, and $bar to $fruit if $fruit were NOT null. I seem to recall getting burned for doing things like this in PHP, and I've never lear...

Low Level PHP Variable Passing Question

Hello All, I am new... to the site and to PHP in general. Please forgive my ineptitude. Anyway, I tried poring over the tagged posts for "passing" "variables" etc. Got some bites, but not exactly what I need. Unfortunately, I learn things by reverse engineering, so like many, I've been going around stealing snippets of PHP and adap...

PHP - REG_BADBR error when using ereg() for regexp

Hello, I have this piece of code for email verification : function VerifRegisterEmail(&$email) { if(empty($email)) { return false; } $pattern_email = '^[[:alnum:]\.-_]+@[[:alnum:]\.-_]+\.[[:alpha:]]{2, 3}$'; if(!ereg('^[[:alnum:]\.-_]+@[[:alnum:]\.-_]+\.[[:alpha:]]{2, 3}$', $email)) { echo "emaill"; return false; ...

Do not allow hot-linking of images unless logged in

I just ran into something today that I am not sure how it is being done. I know a few things: The site is done in php There is an image gallery, a url would be something like http://www.example.com/girls/Cyn/sets/getImage/1170753147/7.jpg I can see that url, as long as I am logged into the site. It does not appear to be referrer based...

Know of any open source zend framework calendar?

I'm trying to find an open source PHP calendar that will play nicely with my zend framework application. Ideally, I should be able to display the events on the public site, and add/edit/delete events in the admin section. Anything that would keep me from re-inventing the wheel so I can get a head start would be great. Update: At the mo...