php5

Connecting to MySql database handle via PHP

Before looking into my question, lets consider the fopen in C. There are multiple ways of opening a handle fopen("abc.txt", "r"); fopen("abc.txt", "w"); fopen("abc.txt", "rw"); Similarly, will we be able to connect to a MySql database. To be more specific and clear, if i want to just read the database, all i need is select query. But...

Need for splitting reads and writes in Elgg

Hi all, I was looking into the configuration options of the Elgg, the open source social networking site. There was an option which allowed splitting the database connectivity into read and write and even multiple connections for reads and writes. I am not sure as why the splitting of read and write is needed. If I am not clear ...

PHP get_called_class() alternative

I've got an Abstract PHP superclass, which contains code that needs to know which subclass its running under. class Foo { static function _get_class_name() { return get_called_class(); //works in PHP 5.3.*, but not in PHP 5.2.* } static function other_code() { //needs to know echo self::_get_...

PHP SoapClient Timeout

Is there anyway for a SoapClient Request to time out and throw an exception. As of now, I get PHP Server response timeout, in my case 60 seconds. Basically what I want is, if there isn't any reply from the Web Service within certain time, an exception would be thrown and I could catch it. The 60 seconds warning is not what I want. Is it...

Php / MySQL search function: there must be an easier way of achieving this?

//lets get the auto name set $accepted = 0; $sql = mysql_query("SELECT * FROM ".TBL_FACTIONS." WHERE f_name='no_name'"); $numrows = mysql_num_rows($sql); //default name 1 if($numrows == 0){ $auto_name = 'no_name'; $accepted = 1;} //default name 2 if ($accepted == 0){ $sql = mysql_query("SELECT * FROM ".TBL_FACTIONS." WHERE f_name='no_na...

uploadify s3 404

Hi. I have made use of the jQuery uploadify example with Amazon S3 and seem to be getting an error 404. Where is this error coming from... In the example it states that all you need to do is change the details and obviously replace it with your credentials, (AWS key, AWS Secret and bucket name) which has been done, but for some reason ...

Zend_Captcha_Image generates empty captcha :(

Hi, i have strange problem when using Zend_Captcha_Image. Sometimes it generate empty captcha, only with lines and dots, but with no text :( EDIT: It happens for every 4-10 pageview/image refresh. Look here for registration form here This only happens on one server. At another with same OS it is without any problem. Anybody with sam...

php newbie class help.

class Theme { function __construct() { } function load( $folder, $file ) { $theme_path = ROOTPATH . '/theme/' . $folder . '/' . $file . '.php'; require_once($theme_path); return TRUE; } } on index.php <?php require class.theme.php $theme = new Theme; $theme->load('site','index'); ?> ...

Class instance variables becoming null in php

I have this PHP class, whose purpose is to fetch some configuration data from a database and store it for later use: class GSConfig { private $configurationData; private $repository; public function __construct($pRepository) { $this->repository = $pRepository; $this->configurationData = $this->InitializeConfiguration(); ...

PHPMailer question

I am getting the error Fatal error: Uncaught exception 'phpmailerException' with message 'Invalid address: ' etc. etc. etc. and it is a real eye sore on the page. So I want to capture the error or suppress it or something - and then have it be returned to the form so the user can be told there is an error and to re-input their email add...

how to retrieve table name from database in mysql?

i want to retrieve table name from database plz suggest me query. i am using phpmyadmin database. ...

Email templates stored in XML. How to execute php inside the xml?

Hi all, I have an email xml file like this: <?xml version='1.0' standalone='yes'?> <emails> <email id="contract-expired"> <description>We send this email when we want to inform a user that a contract is coming up to it's expiration date</description> <subject>Example: Contract Expiration</subject> <parameters> <par...

is there any way to find php application is compatible with particular version or not.

I have one big php application running on php 4 but I want to move this application on php 5.2 but I am not sure whether it's all functionally work on it or not as I don't want to test full application again. So I want to know is there a way to find out compatibility of application with php versions. ...

php-cgi processes not closed off after script finishes executing - PHP5.3.3, Win Server 2003, apache

I have a strange problem running PHP5.3.3 on a Windows 2003 server with Apache. Sometimes scripts that have been initiated finish the work that they are doing, but the process does not close. This can leave a large number of orphan php-cgi.exe processes running, but not, apparently, doing anything (not using any CPU time). After a whi...

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? ...

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 ...

How to determine user defined function parameters names before calling it?

In PHP, I have created a user defined function. Example: <?php function test($one, $two) { // do things } ?> I would like to find the names of the function parameters. How would I go about doing this? This is an example of what I would like: <?php function test($one, $two) { // do things } $params = magic_parameter_finding_...

Trying to port C# function to PHP5

I'm trying to convert this function into PHP but somehow it does not give same results. public static string EncodePassword(string pass, string salt) { byte[] bytes = Encoding.Unicode.GetBytes(pass); byte[] src = Convert.FromBase64String(salt); byte[] dst = new byte[src.Length + bytes.Length]; byte[] inArray = null; ...

Scrambled class name passed to spl_autoload_call via call_user_func

I have discovered interesting behaviour of php while calling different classes dynamically. For some reason class name get scrambled and its look like slice of hashed string. here is example of php code I'm trying to execute: call_user_func(array('app_event', 'arrayItems')); Here is backtrace of this event: Array ( [0] => Array ...

HTTP Error 500.0 - Internal Server Error with IIS 7and PHP 5.3

I have configuired PHP 5.3 on IIS 7 using the following instructions: http://www.php.net/manual/en/install.windows.iis7.php and it works fine. Util I enable any extension from .ini file. After enabling any php extension I am see the following errors : HTTP Error 500.0 - Internal Server Error C:\PHP\php-cgi.exe - The FastCGI process ex...