php

I need some advice on storing data in mysql, where one needs to store more than one, let say userids for a single post?

In cases when some one needs to store more than one value in a in a cell, what approach is more desirable and advisable, storing it with delimiters or glue and exploding it into an array later for processing in the server side language of choice, for example. $returnedFromDB = "159|160|161|162|163|164|165"; $myIdArray = explode("|",$ret...

Echo each Catagory from a table into its own DIV

Hey, My problem seems complex to me, but im sure theres a simple way to do this. Essentially, I have a treatments list. On the MYSQL table the list's items are broken up by catagory, title, description and price. I need to echo out each catagory into a div each, sectioning them off. So, if the user has 4 catagories of items then I sho...

PHP: How to calculate person's age in months+days ?

I want to calculate person's age in months plus days using date of birth (example: 1986-08-23). For example: 0 months and 25 days old. 5 months and 20 days old. 150 months and 4 days old. 285 months and 30 days old. Any Idea? Thanks. ...

Overriding fetch() for PDO when fetching using foreach

I have extended PDOStatement and modified the fetch() method to typecast values of the types timestamp and arrays, in PostgreSQL, to DateTime and native array. This works as intended but I can't override the behaviour when using the statement in a foreach. I have solved this by returning rows into an object implementing ArrayAccess, Ite...

speeding up ajax requests - can gzip compression be applied?

Hi guys I want to speed up my ajax requests, I'm returning large amounts of information from the requests and was wondering if any sort of compression could be applied here to speed things up a bit. My ajax requests typically all send in JSON encoded objects such as objects and arrays which contain html elements and other stuff at time...

I'm looking for a CMS like dotcms but written in PHP

I'm looking for a PHP CMS that works a bit like dotcms. It needs to: Provide the facility to create new content types/structures and surface content from these in modules added to a page. Provide the ability to graphically add and move pre-created modules around a page (moving up/down within the same column is acceptable). Store all co...

Single quotes rejected by html purifier

This is related to http://stackoverflow.com/questions/3290766/htmlpurifier-adding-to-ignore-list. I have added a couple tags to the whitelist. I have this code now - $config->set('HTML', 'AllowedElements', array("customreport", "column", "columnseq")); $def = $config->getHTMLDefinition(true); $def->addElement("customreport", 'Block', ...

PHP on windows and signal handling

Hello, I have a standalone PHP script and I would handle signal sent from Windows OS to do a graceful shutdown when "kill signal" is issued. Do you know what to do that on Windows OS? Thank's in advance. Regards, Alberto ...

PHP session and multiple mixed PHP/HTML sections in one page

If I have a page with multiple <?php ... ?> sections interspresed with pure HTML sections. I notice that a $_SESSION varible set in one <?php ... ?> section is not available in another on the same page. So, what's the best practise? 1) call session_start() as the first line of each <?php ... ?> section? 2) only have one <?php ... ...

PHP String Comparison == vs strcmp

it seems that PHP's == operator is case sensitive? so is there any reason to use strcmp()? isit safe to do something like if ( $password == $password2 ) { ... } ...

[php] get socket error string when async connect fails

hi all anybody knows if its possible to retrieve some error info (like getsockopt SO_ERROR in C) if an async connect like the following fails btw: im not using the socket extension cause streams provide an ssl wrapper <?php $ctx = stream_context_create(); stream_context_set_params($ctx, array("notification" => "stream_notification_call...

How do I write this array in simple method??

I do have a function which do calculations a lot. $arrleft and $arrright are two different arrays. what I am doing here is I am combining two to produce together output for my current application. what I done is a simple method and it eats lots of space and time. what I want is if any one can make this code to a couple of lines shorter...

PHP: HEX to CMYK

How do I convert a HEX color value to CMYK equivalent in php? I want to write a function that does that. But Ive got no clue how to convert hex to CMYK eg: <?php hex2CMYK('#000000'); //result: array('0.0','0.0','0.0','0.0'); ?> ...

E-mail verification through e-mail & PHP?

I have seen on some sites where the user can simply send a blank e-mail to something like [email protected] to have their e-mail verified if they are having trouble getting the verification e-mail. I have a website with PHP/MySQL that I'd like to implement this same functionality, but I haven't done much with e-mail besides sending it s...

IFrame Comet response contains no data

Hi. I'm experimenting with Comet and I'm stuck with implementing it via a hidden IFrame ("forever frame". This is my index.html: <!DOCTYPE HTML> <html> <head> <script type="text/javascript"> cometResponse = function() { var debugOut = document.getElementById('debugOutput'); return function(response) { ...

PHP: How to get a Date when a person reach to a specific age?

I am working on task in which dates are involved. I have a person's age in months+days. Now I want to get a date when this person reach to a specific age in months. For example: A person is 250 months and 15 days old on 2010-1-25. On which date this person will become 300 months old? Function Signature may be: function getReqDate( ...

send array using jquery

i have a variable $visitRecord->getReferallist() which get the list of doctors in an array . i need to send the array to a php file and do foreach action in php file.. how do i send this array variable in the jquery . This code did not work. function seekOpinion() { var queryUrl = "<?php echo $this->url(array('controller' => ...

PHP recursive function to retrieve all children of a category

Hello guys, I would like to write a recursive PHP function to retrive all the children for the specified category. I tried the one described here but it didn't output what I have expected. My categories table looks like this: CREATE TABLE `categories` ( `category_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `category_name` var...

About Flex with PHP kick start

Hi php flex devs, im a php developer and i wish to start application with php flex combination any one drive me a gud tutorial/samples other than zend tutors. since im working with drupal i have no idea about zend concept is that i need to know sactionscript to start flex? Thanxs in adv, Gobi :) ...

calling include from an included file

So, examining this directory structure /include_one.php /include_two.php /directory/main_file.php Assume that I am in /directory/main_file.php and I call include('../include_one.php'); inside of include_one.php, to include include_two.php. Do I need to call include('include_two.php); or include('../include_two.php');? So my question...