php5

PHP E_STRICT and __autoload()

I am using __autoload() which simply looks like this: function __autoload($class_name) { require_once($class_name . '.class.php'); } When the error reporting is E_ALL it works fine. The class is loaded, and the script runs without errors. When the error reporting is E_ALL | E_STRICT, no pages work, I simply get: "Fatal error: Clas...

Screen Scraping in PHP with login

Looking around for a solution to this, I have found different methods. Some use regex, some use DOM scripting or something. I want to go to a site, log in, fill out a form and then check if the form sent. The logging in part is the part I can't find anything on. Anyone know of an easy way to do this? ...

Zend_Db_Table subquery

Hi, I have a some SQL that I want to use with ZendFW, but I can't get it working and it's driving me crazy. I get the correct result with this query: SELECT DISTINCT e.festival_id FROM entries AS e, mail_log as m WHERE e.status = 1 AND e.festival_id NOT IN (SELECT m.entry_id FROM entries AS e, mail_log as m WHERE m.entry_id = e.festi...

Can my code be more efficient?

I have to put my database's data in this format (values will differ, obviously), I think it's called an associative array (I'm horrible with terminology). $values=array( "Jan" => 110, "Feb" => 130, "Mar" => 215, "Apr" => 81, "May" => 310, "Jun" => 110, "Jul" => 190, ...

How Can I loop with array ?

When In print_r or var_dump echo "<pre>"; echo var_dump($groupname); echo "</pre>"; I got the result array(2) { [0]=> object(stdClass)#330 (1) { ["name"]=> string(3) "AAA" } [1]=> object(stdClass)#332 (1) { ["name"]=> string(3) "BBB" } } Now I want to got the result from the array. AAA | BBB ...

downcasting in php5

I've realized that there's no downcasting in php5. Is there a common pattern to achieve it? ...

'XMLHTTPRequest is Undefined' IE6

Hai guys, I got the error 'XMLHTTPRequest is Undefined' in IE6 when i load data via ajax to another drop down in php.... ...

PHP transform array from one dimenson to two

Hi, some "simple" problem: I've this array; $myArray = array( 'FOO', 'BAR, ); i want : $mayArray = array( 'FOO' => array(), 'BAR' => array(), ); in the moment iam doing it with an foreach: foreach ($myArray as $key => $val) { $newArray[$val] = array(); } $myArray = $newArray; is there an easyer way ? ;-) ...

Is there a minimal php5ts.dll?

I've completed my web app and am using mongoose to serve the php pages. The whole app & mongoose is less then 2MB. The php5ts.dll is almost 5MB so that really adds bloat. Also, my app is very minimal so I don't need many of the php features, ie. mysql & crypto. I've used UPX to compress it down to 1.7MB, however thats the same I was ge...

PHP continue statement

Hello Guys When reading a PHP book I wanted to try my own (continue) example. I made the following code but it doesn't work although everything seems to be ok $num2 = 1; while ($num2 < 19) { if ($num2 == 15) { continue; } else { echo "Continue at 15 (".$num2.").<br />"; $num2++; } } ...

[PHP]: Connection variable in a class generates error while closing connection.

Below is my DB connection class. The problem is that when I try to access the CloseConnection function from my code, it gives error: "Unknown MySQL localhost". I use "dbconnection::CloseConnection" through my other code files. It is successfully opening the connection, but giving error in "$conn". final class dbconnection { privat...

A Div section not executing

In my below given code, the second DIV section is not executing. The PHP code contained therein is not executing. I added a test echo, but it is not displaying it also. Why the control is not reaching there. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html> <head> <meta http-eq...

A public static function in a class not executing.

I have a .php file with HTML code also in it. Through this file I am calling a function in another .php file that resides in a class. The call is not working. It is simply not entering the function in the class. Below are the codes of first and second file respectively. <div id="sectionGrid"> <!-- Begin of Grid Section --> <table ...

how expensive is this php downcasting workaround

This question is related to http://stackoverflow.com/questions/1721949/downcasting-in-php5 How expensive is this php downcasting workaround? Is this php downcasting workaround too expensive? I've echoed microtimes and It seems that it takes like 0.001. I wonder if It could be a problem in a large foreach. public static function to(...

Getting started with a project using Zend Framework

Ok, I've got Zend all set up and my hello world pages working. Personally, I'd rather code this from scratch, but I'm trying to find out how to use Zend to save time when making similar projects over and over again. I want to: Admin: Create multiple admin accounts Have database-stored admin options that will be available on all php ...

PHP and MYSQL: Why does A work and B not work?

First of all, I am using the DATE_ADD function for MySQL. When trying to use $sqlA in php, it saids syntax error for some reason (mainly the area after WHERE). Why? $sqlA = "SELECT $column_name FROM $table_name WHERE Date >= DATE_ADD(CURDATE(), - INTERVAL 3 DAY)"; However, it works without DATE_ADD: $sqlB = "SELECT column FROM table...

How to Find Missing Value Between Two Mysql Tables

select userid from cw_users where NOT EXISTS(Select userid from cw_users_data) The previous query won't do the job of course. Trying to find only a missing 'userid' from tableb by doing a comparison. Both tables contain 'userid' and there should be one similar on each. I'm trying to find which one is missing on second table. ...

Is it a bad idea to rely on PHP 5 features when writing an application you expect to be portable?

If I'm building a PHP system which I expect to port to many different servers, should I avoid relying on PHP 5 features such as exceptions and final methods? How widespread is PHP 5 by now? Should I be worried about compatibility and ditch exceptions and other features not available in PHP 4? ...

Official end of support for PHP4?

Is there an official date for when support for PHP4 will end? I keep reading this date and that on various sites and blogs, but can't find anything on the PHP website. Am I overlooking something? ...

PHP5 OOP Tutorial or examples

Hello, I am currently trying to get my head around OOP in PHP, I understand the basic concepts etc. Up to this I have been working for tutorials and books. What I am looking for is some good tutorials that use real examples [ie make a functioning application] or a simple well written application [with source code] so I can look through ...