php5

Using an object as an array

In recent updates to PHP, they added in various interfaces to allow an object to be treated as an array, such as ArrayAccess, Iterator, Countable, etc. My question is, would it then make sense that the following should work: function useArray(array $array) { print_r($array); } useArray(new ArrayObj(array(1,2,3,4,5)); As of righ...

Why is there a mime type inconsistency with firefox, chrome?

I was puzzled at first why my files weren't uploading for some users and I found out it was everyone who wasn't using chrome which was the browser I was testing. Basically I'm doing a file check to make sure they are only able to upload mp3s. This this was working for chrome, but not firefox. if ($_FILES['uploaded']['type']=="audio/mp...

Why Does this Loop Return 1 when using && instead of 'and' ???

Riddle me this... in the while($row = mysql_fetch_assoc($result) and $runningOK) loop, if the PHP && operator is used in place of the and the mysql_fetch_assoc fails terrible and returns just the number 1 when running. I've tried mysql_fetch_array() and in place and I still have the 1 problem. It is when, and only when, I replace the && ...

recommended production environment for php5 application on windows?

We are about to deploy a php5 / symfony / mysql application on a windows stack (windows 2003 server) Our IT department doesn't have much experience administering any other stuff but microsoft technology, so I'd like to know what configuration would you propose for a production environment... apache and php on windows? php on iis? etc...

full path of input file to send mutliple attachments php

When retrieving the path from the input file, using $_POST, the path is being picture.jpg and I need to have the full path i.e. C:/C:\Documents and Settings...\picture.jpg what do i have to use ??? ...

Helping using FirePHP to debug a .php application

Hi, just set up FirePHP and using a framework called Qcodo / Qcubed. Has anyone heard of these on SO? Been having challenges debugging -- trying to do a fairly simple new() and save() and then output via Ajax but not getting any kind of responsiveness from errors. Any help for us, two of us have checked it out but can't seem to get a ...

How to edit an array's key?

Is it possible to edit the key once it has been made? I know you can create an array with a different key but I couldn't see anything on the php site about editing the key latter. Original array: Array ( [0] => first [1] => color ) What I would like: Array ( [newName] => first [1] => color ) ...

PDO mySql query not executing in for loop the second time up while calling

I have an issue, I'm looping threw a set of values and then creating a PDO mySql query with every loop, now the problem is the first query is executing and returning results, but the second upwards aren't returning results. If I manually execute the queries on the server they return results. This is weird, maybe I'm doing something wrong...

calling a method from another method in same PHP class

Hi, I'm trying to use a method from within another method in a class. I don't have much experience in PHP5 OOP, and I looked around for answers, but couldn't find any. I'm trying to use getClientInfo() in sendRequest(), which is in the same class. class DomainHandler { public static function getClientInfo($db, $client_id) { ...

[KO3] Remember the session with Auth module ?

I'm trying to make the Auth module to 'remember' the user session with a checkbox on the login page. What happens is that no cookie is created, only session as usually. I've noticed the user_tokens table, but don't see any use of user_token model's methods at all. I do pass (bool) TRUE as a third parameter to login() method, but there's ...

Convert String To date in PHP

How can I convert this string 05/Feb/2010:14:00:01 to unixtime ? ...

PHP5 - Fails to resolve hostnames when not in interactive mode.

I'm working with an OS X 10.6 Server running Apache2 / PHP5 and having a problem with PHP not resolving hostnames when 'fopen()' tries to retrieve a file from a remote server. When run in interactive mode on the command line 'fopen()' works perfectly. However, when run through the web it will always fail with the error: failed to open s...

What method is the best to copy files from one server to another using PHP

I need to copy a couple of files over from one server to another using PHP. Now I currently use PHP FTP functionality which is ok but causes issues. Are there better ways to accomplish this? ...

php setcookie fails under php5

I created this simple script which will either set a cookie with three values or retrieve the cookies values if they are already set. On my server running PHP4, everything works. On my server with PHP 5 (5.2.11), the script fails to set the cookie in the browser. I already checked if output buffering is enabled in my php.ini and it i...

Zend_Cache vs cronjob

I am working on my bachelor's project and I'm trying to figure out a simple dilemma. It's a website of a football club. There is some information that will be fetched from the website of national football association (basically league table and matches history). I'm trying to decide the best way to store this fetched data. I'm thinking ...

How to Cast Objects in PHP

Ive some clases that share some attributes, and i would like to do something like: $dog = (Dog) $cat; is it posible or is there any generic work around? Its not a superclass, or a interface or related in any way. They are just 2 different clases i would like php map the attributes from a cat class to a dog and give me the new object. –...

How to you insert into MySQL database and returns its id in PHP PDO?

Is there a way to insert into MySQL database using PHP PDO and return its id? Or I will just have to search fot its id after insertion? ...

MySQL match against - IN BOOLEAN MODE?

Hi there, I'm using PDO to execute a MATCH AGAINST query. The following returns nothing: SELECT title, author, isbn, MATCH(title, isbn) AGAINST (:term) AS score FROM books WHERE MATCH(title, isbn) AGAINST (:term) ORDER BY score DESC LIMIT 0,10 Where as this returns perfectly: SELECT title, author, isbn, MATCH(title, isbn) AGAINST ...

Issues uploading CodeIgniter from localhost to website

Hi all, I've been developing a website locally with CodeIgniter and have tried uploading it to my web server and get the following error (which I've never seen until the upload). Fatal error: Class 'CI_Hooks' not found in <snip>/system/codeigniter/Common.php on line 136 I've read that CodeIgniter doesn't play nicely with PHP 5.3.x, e...

SQLSTATE[08004] [1040] Too many connections

i'm getting this error messages SQLSTATE[08004] [1040] Too many connections,i'm using pdo adapter...do i need to close connection...and how i do that ...