php

How to generate Generate lighter/darker color PHP?

Hello . I have a code of color. For example #202010 . How to generate a new color code which is either lighter or darker by 20% (or given x%) in php.? Please help me . I see a sample in javascript but i don't understand it. PLEASE HELP ME ...

Why does this very simple array iteration not work?

I have the following array Array ( [0] => Please enter address line 1 [1] => Please tell us your first name [2] => Please tell us your last name [3] => Please tell us your email [4] => You must tell us one phone number [5] => Please tell us second applicants title [6] =>...

Number replace pattern issue with RegEx

I have the string page-24 and want to replace 24 by any other number. The script is written in PHP and uses preg_replace, however this problem should be independent from the programming language. My match pattern is: (.*-)(\d*) The replace pattern would be: $1[insert number here]$2 The backreferences work, but I cannot insert a numbe...

Extends class [PHP]

In kohana 2.3.4 system load first application, after modules and system. I want to extends User_Model in application with User_Model in modules. How to do that? ...

error in array_filter

Dear all, I have an issue here with filter_array. below is my code: $array = array("0","0","1"); function returnzero($d){ if($d=='0'){ return $d; } } $all_zeros = array_filter($array, "returnzero"); echo count($all_zeros); I would like to filter out all values that none other than zero. Above is my code. However, th...

proper way to logout from a session in PHP

I have read many php tutorials for logout scripts, i am wondering what could be the proper way to logout from a session! Script 1 <?php session_start(); session_destroy(); header("location:index.php"); ?> Script 2 <?php session_start(); session_unset(); session_destroy(); header("location:index.php"); ?> Script 3 <?php session_st...

PHP - application patch build

I'm trying to come up with a better solution for our development group to build patches for our applications (PHP). We currently submit to SVN daily, but do not run a continuous integration server, as code checked in can be buggy. For building patches, we check against a "date modified", from the last build. A lot of times though, we'...

magento - Image type and information need to be specified for each store view

Hi, I have a working Magento 1.4.1.0 installation that is due to go live next week, all was well until yesterday when I noticed the following message when uploading images to a product 'Image type and information need to be specified for each store view'. The image uploads fine and is visible on my server, the preview works when I hover...

Google checkout

I'm new to Google checkout, I went throw the examples but still have some problems. I'm able to create the order throw HTML and XML, but I need to be able to know in my system that the order was payed. I try the notification callback an polling, but I'm not sure how can I link the Google order with my order in the system. I check the re...

Want to dynamic the row display depend on order of table header

<?php $header = array('header1','header2','header3'); ?> <table> <thead> <tr> <?php for($i=0;$i<=count($header);$i++){?> <th ><?php echo $header[i];?></th> <?php } ?> </tr> </thead> <?php foreach($result_from_db_query as $key=>$val){?> <tr><td><?php echo $val['Column1']?></td><td><?php echo $val['Column2']?></td...

Rounding in PHP

$a = ((0.1 + 0.7) * 10) == (int)((0.1 + 0.7) * 10); PHP returns false. Could anybody explain me, why that happens? First returns 8, second 7. ...

Alias Domain to Zend Directory

I have a ZF website at domainA.com and I'd like to alias domainB.com to something like: domainA.com/photos/album so that album would be the root of domainB. How might this be accomplished? ...

Error connecting to Google Adwords through APIlity after killing script. Why?

I have to use the Google APIlity client (through v13) to access account information. If I am running the script I wrote and I kill it on the command line using CTRL+C, I get an error when I try to access the API using: $apilityUser->getManagersClientAccounts() Any Ideas? require_once('apility/apility.php'); $apilityUser = new APIlity...

Upgrading a PHP/MYSQL application?

I'm looking for inputs into how I can manage the upgrade process itself of a homegrown php/mysql application. Meaning, if we have a 'stable' version of our php/mysql application working on our production server, and we now want to upgrade it to the next version that we've worked on - how do we go about doing that elegantly? What practice...

Correct link in PHP error text

On my localhost if I'm working on a project in http://localhost/project_name/ whenever I get an error or a warning it contains a link to the function but the link points to the wrong place, e.g. it points to http://localhost/project_name/function.rename I have the many-HTML manual in http://localhost/php_manual/ is there a setting by wh...

One parent row, multiple child rows in another table. How to get them all in one row?

I volunteer for a local non-profit that gives out toys and food during the holiday season. One way that I am helping them is by putting their gift/food requests online. This way instead of manually entering 1,000 or so names manually into Excel over the course of 15 hours they can simply click on a link and have the whole thing exported ...

eCommerce Framework, Currently looking at Magento

Hey guys, I kind of wanted to ask an opinion based question to start off with. I'm going to be picking up an eCommerce project in a month or two so I've been trying to decide which PHP framework, if any at all, I should go with. What does everyone recommend? Currently, I've been working through some Magento tutorials. One of the things...

PHP Random numbers

Hello, I would like to draw a random number from the interval 1,49 but I would like to add a number as an exception ( let's say 44 ) , I cannot use round(rand(1,49)) .So I decided to make an array of 49 numbers ( 1-49) , unset[$aray[44]] and apply array_rand Now I want to draw a number from the interval [$left,49] , how can I do that u...

magento configurable product behaviour

I am having the following issue with my magento, custom unfortunately, development. The scenario is that the client wants the price of a configurable product to be calculated using a specific formula that involves multiplications, while magento has only sums. for example one of the attributes is "material" and the other one is number of ...

Escaping special characters

Hi everyone ! Just a quick question. I want to send data from Javascript to a PHP script to store it in my database, then getting it back the same way (a script calls a PHP function, and data is sent back with JSON). Which function should I use in the javascript ? I should never need to get the data only with PHP, so is it ok to use e...