php

Mysql store procedure performance

Hi How is store procedure's performance? Is it worth using them or implement a complex query in PHP-MySQL call? Regards ...

Exception handeling performance

Hi While using try-catch blocks, even if any exceptions are not thrown, does it consider performance of the code? I wanted to code my own Exception handler which extends from standard exception class, was wondering if this situation downs the performance of the page on several calls. Regards ...

facebook connect using FB.Connect.showFeedDialog without fb:login-button

I have a facebook application set as a iframe and i'm trying to use FB.Connect.showFeedDialog to publish stories to a users feed. I'm working from this example http://papermashup.com/using-facebook-connect/ which doesn't work until you login using the fb:login-button. I've been attempting to modify the code for several days and I was w...

Registry design pattern...good or bad?

The following code is from a tutorial (http://net.tutsplus.com/php/creating-a-php5-framework-part-1/), not mine. I have a few questions about this code... The article claims it is using the "registry design pattern"; is that the universal name for this design in the industry? Is there another similar patter out there that would be a b...

Array issues, and where in clause

i'm having some trouble trying to use a query result as an array First i run a query to get all the zips that i need $this->db->select('zip'); $this->db->from('custom_city'); $this->db->join('city_to_zip', 'custom_city.id = city_to_zip.city_id', 'left'); $this->db->where('city_to_zip.city_id', $_POST['city']); $zip =...

Problem uploading a file via ajax using PHP

Before starting, note that I have to update a website that is not mine, so I can't redo the whole logic. If I were to do this I would do it differently. I have a cakephp application with a form with a lot of fields. In this form you can browse for a file and save it asynchronously. Here is how it's done: <input type="file" name="data[F...

PHP - extract() type

Hello, PHP's extract() function can take on one of several extract_types. But what's the difference between extr_prefix_same and extr_prefix_if_exists? The manual makes it sound like, in either case, new variables will be prefixed if the variable name already exists. Thanks! ...

Merging MySQL Query results with PHP

I have a table of Calendar event information (Date, username). I want to print the following information for each "event" for a selected month in a table, using PHP and MySQL: SELECT DAYOFWEEK( eventDate ) AS DAY , YEAR( eventDate ) AS YEAR, `primary` , secondary, weekend FROM eventcal WHERE region = 4 AND MONTH( eventDate ) =7 O...

Best way to use a server side language for development, but deploy to static HTML

We have a client for whom we build a lot of template based sites. Ideally we would use something like kohana (http://www.kohanaphp.com/) to handle the templating and make doing site wide changes a breeze. Unfortunately our client cannot (and will not) host any server side code (and before you ask, this will not change and hosting the f...

Facebook Invite not working in internet explorer

Hi, I have developed an application with invite functionality in php. It is working fine in mozilla but its not working in ie7. What is the reason behind it please help me on this? ...

Zend Mail - can't send mail from online server - connection refused error

Hi guys, I'm using the zend framework and have a script which sends emails. However my script send emails perfectly on my localhost but I keep getting a fatal error on my online server: Fatal error: Uncaught exception 'Zend_Mail_Protocol_Exception' with message 'Connection refused' in .... The stack trace pin points just my emailing c...

Transparency with background image using GD

Using GD2 to fill in a transparent png with a solid colour, here is my code and the result. Basically as soon as the transparency begins, the fill colour stops abruptly instead of blending in with the transparency. private function GenerateImage() { $original = imagecreatefrompng($this->ImagePath()); $x = imagesx($original); $y = im...

Escaping only what is necessary, is that possible?

I am working with a team of developers on a website. The website will be using classes. I am in charge of creating the data access layer for the classes. There is an understanding that all user input will be escaped upon retrieval (from the post or get). Having little control over the input level (unless I personally review everyone's co...

Implementing own Session Management in PHP

What options are there to implement an own session management in PHP? Is there a nice way to implement a component which performs all session tasks? How can i construct a class which receives the HTTP Request and Response during one request process? I only found the option "session_save_handler" which seems to define the storage handle...

Develop a fast search functionality in a big forum?

Hello! I am building a forum from scratch in PHP. I have used the most of phpBB:s database structure. But now I am thinking about the search functionality?, what is a good design to be able to search really fast in all posts. I guess there must be some better way than just %query_string% in mysql :) Maybe explode all sentences into wo...

Flash file upload vs php file upload - which one to choose?

Hi I was trying to upload a photo on facebook using a browser with no flash, and could see that it didn't work. I am pretty confident in handling files and related issues using Php and have done some sites allowing users to upload and manage files (images, docs etc). But I never thought about the above flash approach. I googled a bit ...

PHP- Getting yesterdays data from the database

I want to get yesterdays entries in the database. Any ideas on what query I should run? Its been blowing my mind for the last hour! mysql_query("SELECT id , fullname , address1 , address2 , citytown , postcode , telno , email , property_value , on_market , agent , asking_price , reason , total_secured_debt , price_concession , FROM_UNI...

Questions about default deploy Task in Capistrano for PHP project and config.php

Hello All, I'm having a full day understanding the use of Capistarno. Is really a nice tool that will save me lots of time. I'm actually wanting to use it to deploy one of my many php apps :) If I have a config.php with an $env="development" variable. Is there any way to make Capistrano change this variable for me to "production" inste...

Output in XML using PHP

header('content-type: application/xml'); echo '<'.'?xml version="1.0"?'.'>'; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;'; echo '<root>'; $hierarchy=$tree->getArray(); recursiveBuild($hierarchy[0]); echo '</root>'; I am printing this as output to get...

php arrays with only one type

I'm looking to create an array or list with elements of a certain type (eg objects the implement a certain interface). I know I can create an object that does the same thing implementing Traversable and Iterator, or override ArrayObject. But maybe there's another way I have missed. ...