php

How to send a variable from index to controller in opencart

Hi, i want to set a variable in index.php and want to access that variable in any controller of open cart. ...

how to do $class::function($data);

hi there, i have several classes that have the same function, the are called at different times, depending on different variables, so what i need is something like $class = 'test'; $return = $class::do_something(); but i get Parse error: parse error, unexpected t_paamayim_nekudotayim. which from the looks of it means unexpected :...

How to get query created by the prepare statement in PDO

Hi all, We can use prepare method to get the query prepared for multiple time use in PDO. But i want to know that can we see all the queries executed at the DB. For e.g see below: <?php // Cosidering DB connection already set here. With $db. // using named placeholder $db->prepare("select * from user where id=:id"); ...

IIS - Mysql Performance Issue

Hi, I have developed a site on linux server(my testing host server). But When I move the site to live server, which is IIS, Windows 2003... my site is very slow. It takes around 20 seconds to load a page. My code is in PHP and I am using Wordpress. Normal Html, Php pages are running fast, but when it connects to MySql.. it takes 4 to 5...

how to validate an image array in php

<input name= "p_image[]" type="file" id="p_image[]"> i need that user upload atleast one image and if it doesn't it show error.. ...

what is the easiest way to change this array to 1D array

Hello what is the easiest way to change this array to 1D array, i can do that using for loop or foreach, but i'm curious to check if there is an easier way. THANKS Array ( [0] => Array ( [id] => 1 ) [1] => Array ( [id] => 2 ) [2] => Array ( [id] =...

Problem editing word file in PHP

So I need to edit some text in a Word document. I created a Word document and saved it as XML. It is saved correctly (I can open the XML file in MS Word and it looks exactly like the docx original). So then I use PHP DOM to edit some text in the file (just two lines) (EDIT - bellow is already fixed working version): <?php $firstName =...

phpredis on fedora 12

hello, am trying to install phpredis to work with my php. but the thing is, everytime i try to get it to work, my error_log sends this error. [code]PHP Fatal error: Class 'Redis' not found in /var/www/html/testme.php on line 5[/code] i have downloaded the source code from http://github.com/owlient/phpredis and then phpize ./configur...

Setting the starting value of an AUTO_INCREMENT field in MySQL

I have a simple question in creating table in database. Here's my code: $query="CREATE TABLE users ( userid int(5) not null AUTO_INCREMENT, firstname varchar(20), lastname varchar(20), username varchar(30), password varchar(32), email varchar(50), age int(2), PRIMARY KEY (userid) )"; I want the USERID ...

How can I modify exif data of an image with PHP

Possible Duplicate: How do I add exif data to an image? I want to modify some information in exif data with PHP. I've googled around but no hope. There's function in PHP, exif_read_data. But it only reads not writes. Anybody knows how or walkaround? ...

i want to add captcha with ajax

hi all, well i have a form in which email and captcha validation was there but now i want to do some thing like if captcha is incorrect or left empty than my form must not reload the page i.e all those field which are already been filled out must not get blank. ...

Easiest way to create a table with Zend_Pdf

Hi What's the easyiest way to create a table with Zend_Pdf? Until now, i realized tables with horizontal and vertical lines. Is there no other solution for tables? Thank you. ...

PHP convert string to array

How can I convert a string to an array? For instance, I have this string: $str = 'abcdef'; And I want o get: array(6) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" [3]=> string(1) "d" [4]=> string(1) "e" [5]=> string(1) "f" } ...

Overwrite cookie failed PHP & ASP cross subdomain

I have problem in overwriting cookies value cross sub domains, a website running in ASP which is in www.domain.com and mobile site running in PHP with m.domain.com sharing same cookie Cookie created in www.domain.com via asp as follow: Response.Cookies("cookie_name")="value1" Response.Cookies("cookie_name").Expires=DateAdd("m", 1, Date...

Sending a HTML email with a midi file that needs to play automatic on open

I'm trying to accomplish the following, I'm sending a HTML email using PHP Mailer that reads a html file and embedding a midi file within the HTML file, and it then sends out the email and then the midi file should start playing automatically once the email is opened, is this possible, since it does not seem to work, I'm using Evolution ...

File Management system in Php

I have my system backed up on a server (Docs, Videos, Music, etc.) I have only FTP access (can't really do anything fancy) However I can run PHP and MySQL programs (pretty basic). I was wondering about a good complete system that would let me upload, control and manage the files I have there (including security features) so that I w...

How to prevent embedding my web page inside an iframe?

Possible Duplicate: How to prevent my site page to be loaded via 3rd party site frame of iFrame How can I prevent others from embedding my web page inside an iframe? ...

Automating tasks with PHP

i wonder how can i schedule and automate tasks in PHP? can i? or is web server features like cron jobs needed. i am wondering if there is a way i can say delete files after say 3 days when the file are likely outdated or not needed ...

Pure WBXML encoding for PHP?

Is there a native PHP wbxml API that can be used platform-independently? Perhaps a loadable module? I have seen the pecl implementations but I have not been able to successfully work with the builds on win32 platforms. ...

Group photos by color

I have a pretty big number of photos and a RGB color map (let's say of about 100 colors). How can I group the pictures by color and obtain something like the following: http://labs.ideeinc.com/multicolr ? My current idea is this: Using ImageMagick, do this for each photo: Resize it to a smaller size so that it can be processed faster....