php5

When are infinite loops are useful in PHP?

While reading through the great online PHP tutorials of Paul Hudson he said Perhaps surprisingly, infinite loops can sometimes be helpful in your scripts. As infinite loops never terminate without outside influence, the most popular way to use them is to break out of the loop and/or exit the script entirely from within th...

Check if final record?

I am using mysql_fetch_array and I want to check if it's the final record. How can I do this? ...

How does eval function work in PHP ?

I am trying to figure out how does eval() function works in a simple way. I tried the following code but it doesn't work, instead it shows up a parse error. <?php $str = "exit()"; eval($str); ?> What's wrong with my code ? ...

How to avoid temporary variables in PHP when using an array returned from a function.

The use of $tmp below is pretty ugly. Is there a way to avoid it? function test() { return array('a'=>1, 'b'=>2); } $tmp = test(); echo "This should be 2: ", $tmp['b'], "\n"; Is there some reason the natural test()['b'] doesn't work? ...

mysql_fetch_array() giving error.

The following code is giving error: *Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in W:\Aptana WorkSpace\Website\lib\filldropdown.php on line 22* <?php error_reporting(E_ALL ^ E_NOTICE); $db_host = 'localhost:3306'; $db_username = 'superuser'; $db_password = 'admin'; $db_name = 'exampledb'; //c...

How to fetch QueryString values without using GET?

My AJAX code is passing QueryString to a PHP file. The QueryString looks like this: var strUrl = "./lib/filldropdown.php?DivName = " + DivName + "&DropDownControlName = " + DropDownName + "&SqlQuery = " + SqlQuery; In the file "filldropdown.php", I want to fetch the values from the query string. How to do this without using GET? And a...

The M of MVC (ZF)

I don't get it how it really works. I have a database table user and a model User: <?php class User extends Zend_Db_Table_Abstract { protected $_name = 'users'; } And in the controller I call it: $user = new User() But how do I get for example all users or a user with the id: 1? ...

ORA-24374 error in php script

When I try to execute script PutEnv("TNS_ADMIN='C:\\Programy\\OracleDeveloper10g\\NETWORK\\ADMIN\\'"); $conn = oci_connect(user, pass, dbstring); if (!$conn) { $e = oci_error(); print htmlentities($e['message']); exit; } else { $stmt = OCIParse($conn, "SELECT * F...

ORA-00917 in php script

My php script is as follows: if (!empty($_POST['action'])){ PutEnv("TNS_ADMIN='C:\\Programy\\OracleDeveloper10g\\NETWORK\\ADMIN\\'"); $conn = oci_connect('s14', 'sm19881', 'umain'); if (!$conn) { $e = oci_error(); print "Wygląda na to że mamy jakieś błędy\n"; p...

Zend Certification

Hey all, I'm looking to get my Zend certification soon for PHP5. Has anybody that's taken the exam come out of it with good advice? Are there any useless/nonsense/obscure/esoteric topics covered on it? Thanks ...

Any PHP IDE written in C?

It is my experience that all PHP IDEs written on Java are slow. You just can't compare the performance with Visual Studio. I use Aptana and also used NetBeans. Most of the time, your Intelli-Sense will open when you have moved forward typing syntax. Is there any PHP IDE that meets the performance of Visual Studio? ...

ImageMagick failing to convert to JPG

Hi: We recently installed the latest version of ImageMagick onto our Linux server. I seem to be having issues performing the most basic of tasks. I am running this command line: /usr/bin/convert /location/to/source/design.ai /location/to/save/output.jpg Unfortunatly is saves design.jpg as an illustrator file (if I rename the file to...

Singleton pattern + __construct in PHP4...

To clarify: no I can't make this pure PHP5 yes this code works in PHP 4.3.9. I don't have any real world experience implementing or supporting PHP4 but I had to recently change my class so it supports both PHP4 and PHP5. Can anyone foresee any possible issues in regards to my implementation of the singleton method used here? I onl...

Zend Framework default log level

Hi Is it possible to set default log level for entire applicaton? I would like to set it from application.ini. I would like to set loggers to log to database and firephp. ...

Apache2, PHP5, and Interbase/Firebird on Windows 2003/XP

I have recently upgraded from Apache 1.26 and PHP 4.3 to 2.2.11 and 5.2.9 respectively. With my original setup I had a scheduled task set to run every Sunday for a weekly newsletter. It would connect to my database (Interbase/Firebird) to find out what events were opening for the following week and get the list of addresses the email wil...

Eliminating DEPRECATED errors form the error_log in PHP

Is it possible to eliminate DEPRECATED messages from the PHP error_log? I know I can use ~E_DEPRECATED to keep them from the display but is there any way to keep them out of the error_log as well? ...

how come in php superclasses can access protected methods of their subclasses?

I just noticed this behavior today - weird, I'm pretty sure in java a you can only access protected methods upstream on the inheritance chain since going the other way violates encapsulation. Was there a reason for this behavior in the language? ...

Zend - access layout property from controller

Ahh forgive my Zend newbness, I'm trying to access this form, stored in: layouts/scripts/layout.phtml: $this->layout()->userForm = $this->action('index', 'user'); within class IndexController extends Zend_Controller_Action { public function init () { /* Initialize action controller here */ } public function indexA...

Php explode then get the name row from a MySql Table

I know this has been talked about here before. However, my situation is a bit different and I'm so close. I would like to explode an array of category id's from a news data table then get the category name from the category table. Right now I am able to get the id's out and explode them just fine inside the while loop for the news da...

Where can I find docs for PrestaShop?

I have downloaded and am using PrestaShop - but can not seem to find any docs. The official ones are apparently 'coming soon'. I imagine there should be some 3rd party ones elsewhere.. but can not find with Google myself. Does anyone know of any? thanks ...