php5

Dual AJAX Requests at different times

Alright, I'm trying to make an AJAX Chat system that polls the chat database every 400ms. That part is working, the part of which isn't is the Active User List. When I try to combine the two requests, the first two requests are made, then the whole thing snowballs and the usually timed (12 second) Active User List request starts updating...

memcache redundancy changes key flag

Hi all, I am using memcache in my php application. I am trying to implement redundancy by setting memcache.redundancy = 3 in memcache.ini. When i initially set a key the value of flag is 0 (using telnet). But when I replace the value of the key the flag changes to 768. Do you have any idea why is this happening and how to keep the key...

which situation abstract class i should use

Possible Duplicates: What is the purpose of abstract classes? When to use interfaces or abstract classes? When to use both? Hi , Am not worked on extream level of oops in my projects , So i have little doubts , In which situation should i use abstract method or classes , Basically i know about abstract class definition a...

What is causing Apache2 to display PHP as plain text in this config file?

I am trying to run PHP and Rails in the same virtual host, however, PHP is being displayed as plain/text. When I create a test host without all the rewrites and proxy-ing, Apache2 will process the PHP as desired. Where in my config file have I gone wrong? <VirtualHost *:80> #ServerName staging.domain.com #ServerAlias www.domain.com ...

PHP, MVC, 404 - How can I redirect to 404?

I'm trying to build my own MVC as a practice and learning experience. So far, this is what I have (index.php): <?php require "config.php"; $page = $_GET['page']; if( isset( $page ) ) { if( file_exists( MVCROOT . "/$page.php" ) ) { include "$page.php"; } else { header("HTTP/1.0 404 Not Found"); } } ?> My...

PHP - Resize an image and fill gaps of proportions with a color

I am uploading logos to my system, and they need to fix in a 60x60 pixel box. I have all the code to resize it proportionately, and that's not a problem. My 454x292px image becomes 60x38. The thing is, I need the picture to be 60x60, meaning I want to pad the top and bottom with white each (I can fill the rectangle with the color). The...

How can I convert German characters during XML read and PHP write into mysql?

Morning, I am inputting data from an XML file into my database, but have any isse with German words (that are in the XML by mistake) For example the word für appears in my XML as für and thus appears the same in my database. I know I could do a simple search/replace for that exact phrase, but I was wondering if there was a smarter wa...

Force result for empty() test on an object

Hello ! Simple class for example: class Foo { protected $_bar; public function setBar( $value ) { $this->_bar = $value; } } And here is the question: $obj = new Foo(); var_dump( empty( $obj ) ); // true $obj->setBar( 'foobar' ); var_dump( empty( $obj ) ); // false Is it possible to change class's b...

PHP: recursion keeps values for variables?

i have a function (below) which is used in my mysql abstraction class and converts table names in fields like "tableName.fieldName" and replaces them with the specified variables (it's useful for joins). the array of fields is very mixed, and so i need it to support recursion so that it can change the table names in an array(array(array(...

PHP: Submit a POST query and get RESPONSE

What I need to do, is to make a script, which submit a $_POST query to remote host, and that host is returning an answer on $_POST: <?php if($_POST['passkey'] == "c") echo "OK"; else echo "FAILED"; ?> I use this code: function get_client_answer( $source_host='http://www.example.com/',$source_file='validate.php') { $postdata...

PHP class declaration

Is there any way to set explicit type to object field in php? Something like this class House{ private Roof $roof } ...

Elegant Method of Inserting Code Between Loops

In web development, I often find I need to format and print various arrays of data, and separate these blocks of data in some manner. In other words, I need to be able to insert code between each loop, without said code being inserted before the first entry or after the last one. The most elegant way I've found to accomplish this is as...

How to Practically Split Values from CSV File into MySQL Database

Let's suppose I have the following line in a CSV file (I removed the header row in this example): "500,000",2,50,2,90000 I have a PHP script read the CSV file, break the file into individual lines, and store each line in an array called $linearray. Then, I use a foreach loop to look at each line individually. Within the foreach loop,...

Does PHP5 supports multi threading?

Possible Duplicate: How can one use multi threading in php applications Any body knows PHP5 supports multi threading or not. If it support how to implement that? ...

Get tweets using tokens

Is there any way to get tweet(twitter feeds) to our website. I have tokens(public and private key of twitter account) and i want do with tokens without using user name . ...

How to find a value in array and remove it by using PHP array functions

How to find a value exist in an array and how to remove it. If any php builtin array functions for doing this. After removing I need the sequential index order. any body knows please help me. ...

Fatal error: Cannot use string offset as an array

Array ( [0] => Array ( [auth_id] => 1 [auth_section] => Client Data Base [auth_parent_id] => 0 [auth_admin] => 1 [sub] => Array ( [0] => Array ( [auth_id] => 2 ...

empty() returning TRUE on object's non-empty property

I've got a very weird and unexpected problem. empty() is returning TRUE on a non-empty property for a reason unknown to me. class MyObject { private $_property; public function __construct($property) { $this->_property = $property; } public function __get($name) { $priv_name = "_{$name}"; ...

converter for xls to sql converter

Hi , Am looking converter for xls to sql converter . Or Is There any script for insert from xls spread sheet to table , Regards Bharanikumar ...

Send smtp mail in php with HTML page attach as a text

Hello All.... I have a requirement of sending mail using smtp server in php. Now I am able to send the mail using smtp for a plain text. but I have a requirement where I need to attach an HTML page, which includes set of images. Now for that I am trying the following code : <?php require_once "Mail.php"; $to = '[email protected]'; ...