php5

PHP recursive directory listing - directories ONLY

I am working on a file manager project and can't seem to get my head around doing a recursive directory listing where I only get the directories. Everything I've tried either leaves off empty sub-directories or won't work when I try to parse it into the return structure to my jQuery tree. I've tried using an array, and the recursive ...

How can I retrieve a picture from my database in PHP?

I've stored an image file on my local drive and the path to that image in my database. How can I retrieve the image for displaying it in PHP? ...

How to write a reusable code in cakePHP????

hello friends Can any one provide me some tips to write reusable code in PHP / CakePHP thanks in advance ...

max execution time error handling

Hi! I have one script that sometimes gives Max execution times reached error. This is normal, not this a problem. The problem is that in this case I would write specific error message. How do i do this? ...

php and mysql help, working with multiple database

Hi, I need to work on multiple database, and below is my current code. Following code seems to be very very slow and having issues with multiple connection while I view the mysql connection list. So can anyone let me what's wrong with the code and help me to correct the issues and faster performance. $dbHost="localhost"; $dbUser="use...

how can I define a value for model's field in symfony?

I'm building an app for the company I work for in symfony, non the less the app might be pretty useful outside our company so we decided to write it in a more general form so we can make it multi company. I'm facing a problem on how to define a default value for a field that is going to be in every single model (company_id) so we don't ...

Kohana - Authenticating Users?

I would like to get started on a simple project using the Kohana 3 framework (looks very promising), but the docs are a bit lacking in my opinion and would like some direction to get my feet wet and get me started. So I have a simple use-case question one that most every application needs. How would you present a login form with a usern...

Fgetcsv initial line reading problem

I'm working with a CSV file and PHP5 however I'm not quite understanding what I am seeing. The file is as follows when I open it in a text editor: "Jun 23,2010 21:40","City1","Location1","0 0 0 " "Jun 23,2010 21:41","City2","Location1","0 0 0 " What I get as output from this code: while (($data = fgetcsv($handle, 1000, ",","\"")) !=...

cache problem jquery

I have a fancybox, and for some reason it gets cached. My current problem is layout this way. I have main index page, where I have a link. Clicking on the link open the jquery fancybox. The fancybox is actually opening the page called data.php. That page has a drop down that is populated through the database column. So when I change some...

How can I properly replace a cached item using APC?

I have a setup that uses a method called update in a cache class. It simply creates an array using a key-value pair. For example, if I do $cache->update('cache_key', 'array_key', 'array_value');, that will result in an array a key as array_key with a value of array_value. If I then issue another update using the same cache key, but a dif...

objects..better arrays?

I was just reading through a tutorial and they mentioned that Objects in php are just the better way of arrays. I am confused? Can someone clear the concept for me. thanks ...

Creating a PHP script that emails a file to the user

I'm planning to write a PHP script where a user goes to a particular page, clicks on a link, and a form comes up asking for the user's email to send the file to. After the user selects send to file is sent to their Gmail, Yahoo, Hotmail, whichever. After a successful send, an email is sent to me notifying me of the action. So far I've c...

How to merge two doctrine entities in the same object

Hi, In my database, the user management is divided into two tables: - One created by the symfony sfDoctrineGuard plugin (sfGuardUser), with the username, the password and other information used by the plugin - another one that I created to extend this table with more properties such as the firstname, surname etc... What I want to do is...

Learning Management System using php codeigniter?

Is there any open source Learning Management Softwares that is developed using php codeigniter? a Web based software for delivering,tracking and managing training/education that focuses mainly on Class/session scheduling, Class enrollment/registration, Teachers/Trainers,Students and Lessons/Courses/Categories/Evaluation I'm a BSIT stu...

Does php5 function parameters pass as ponter or as copies?

Hi, Does php function parameters pass as ponter to object or as copy of object? Its very clear in C++ but in php5 I don't know. Example: <?php $dom=new MyDocumentHTMLDom(); myFun($dom); ?> parameter $dom pass as pointer or as copy? Thanks ...

PHP - SPL vs array:: When should we use SPL and when we should use array in php5?

Hi, In java and C++ when we dont know the size - array not used like in php, instead used linkedList etc.. In php exist SPL, but most of the times programers use array, why(because peaple don't know about spl )? When we should use in php5 array and when SPL and what the difference in this case between PHP and Java/C++? Thanks ...

Why have a resource in mysql_real_escape_string?

I've been wondering for the longest time WHY I actually need a live resource to SQL connected in order to use mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier ] ) Does this function not simply escape the data? What's the point of connecting? I want to use the function without a connection, I'm debating cr...

TCPDF - How to display tableheaders on each page of table data?

All, I am trying to render a table with pages and pages of data. The rendering fails utterly from the second page onwards. Also, how can I make sure the table that extends over pages and pages has tableheaders on each and every page? This is the function I am using so far, but it doesn't seem to work very nicely from second page onward...

Why PHP's md5 is different from OpenSSL's md5?

I am quite confused as to why I am seeing different results for md5 hashing in PHP and in OpenSSL. Here is the code that I am running: php -r "echo md5('abc');" Results in: 900150983cd24fb0d6963f7d28e17f72 While this: echo abc | openssl md5 Results in: 0bee89b07a248e27c83fc3d5951213c1 Why? ...

Overriding static members in derived classes in PHP

<?php class Base { protected static $c = 'base'; public static function getC() { return self::$c; } } class Derived extends Base { protected static $c = 'derived'; } echo Base::getC(); // output "base" echo Derived::getC(); // output "base", but I need "derived" here! ?> So what's the best workaround? ...