php5

What's better, isset or not?

Is there any speed difference between if (isset($_POST['var'])) or if ($_POST['var']) And which is better or are they the same? ...

Zend Framework: right way to retrieve data from database

hello guys, am working on a project with zend framework and i need your advise on the right way to fetch data from the database. Am making use of Zend_Layout to load my template. The appropriate view is then loaded into the template. On the template, there is supposed to be a section that displays data from the database (e.g Categori...

How i can retrieve the path for the file that i upload?

hi. im developing a cms. the Table clients contains many fields and one of them is the image caption. When the user uploads a file(image) the file is stored in a public folder. The image caption field retrieves the final name of the file and stores it in the table. The problem is when the user wants to update the information. If the...

Return PHP array name

Array ( [kanye] => Array ( [0] => Kanya [1] => Janaye [2] => Kayne [3] => Kane [4] => Kaye ) [wst] => Array ( [0] => ST [1] => St [2] => st [3] => EST [4] => West ) ) Array ( [0] => Kanya [1] => Janaye [2] => Kayne [3] => Kane [4] => Kaye ) Array ( [0] => ST [1] => St [2] => st [3] => EST [4] => W...

User options in another table: what is the best practice to check if an option is there?

I have several option that a user can have, mainly to validate his presence around the site. Tables are like this: Users: id=1 username=stackoverflow password=oSKAJMMS; address=xyz ... Options: user_id=1 option=AD3 user_id=1 option=AC1 At some point I need to check if he has a particular option (like: AD3, AC1 etc) in the "op...

Two emails when sent via SMTP

I've used two PHP email scripts and routing it through my SMTP server, when I do this though it sends two of the same email. When I use mail() this doesn't happen, but I'd much rather use SMTP. Any ideas why this may be occuring? ...

How do I call static variable in a separate class in PHP?

How can I access a static variable in a separate class in PHP? Is the scope resolution operator the wrong tool for the job? Example: class DB { static $conn = 'Connection'; } class User { function __construct() { DB::conn; //throws "Undefined class constant 'conn' error. } } ...

I need to push into an array values based on a specific condition, what is the correct way to do this?

I have a forcycle that contains a condition (and an incremental value i): if(condition)){$arr[$i] = array("value" => $node->nodeValue));} else{$arr[$i] = array("string" => $node->nodeValue);} In the end I need to have an array like this: Array ( [1] => Array ( [string] => abc [value] => 0,999 ) [2] => Array ( [string...

Is there a list of major OpenID providers URIs that ZF knows how to work with?

Is there a list of major OpenID providers URIs that ZF knows how to work with? ...

Easiest PHP forum to configure to work inside an existing CMS?

I have been assigned to add a forum into an in-house CMS we have been using for some time. The system has its own login/user system and an established user database. Ideally I'd be looking for the easiest forum software to convert to use with our system, but if necassary can rewrite and migrate the user databases to use the forums syst...

Report generation in PHP (formats required pdf,xls,doc,csv)

I need to generate reports in my PHP website (in zend framework) Formats required: PDF (with tables & images) // presently using Zend_Pdf XLS (with tables & images) DOC (with tables & images) CSV (only tables) Please recommend robust and fast solution for generating reports in PHP. Platform: Zend Framework on LAMP I know there are ...

correct use of 'construct' when designing classes

I am new to object oriented programming and writing some of my first classes for a PHP application. In some of the simpler classes, I declare a function __construct(), and inside of that function, call certain class methods. In some cases, I find myself instantiating the class in my app, and not needing to do anything with the resultant...

error_reporting in PHP 4 and PHP 5

I migrated my website from PHP 4.4 to PHP 5.2 The error_reporting level in both cases is E_ALL. On PHP 4 the site was working fine but after migrating to PHP 5 i found that one page is throwing error. Cannot redeclare ClassName:varName I found that the variable was indeed re declared in the file. I want to know that why it was working in...

PostgreSQL not showing up on phpconfig() function(on windows)

I just installed Apache 2.2.11 and downloaded the zip for PHP5.2.9-2 I uncommented extension=php_pdo_pgsql.dll and extension=php_pgsql.dll But when I call the phpinfo() function, postgresql is not showing up. What am I forgetting? Also, on the PHP site, I found this: In order to enable PostgreSQL support, --with-pgs...

PHP Namespace separator

Someone remind me why "." is not used as the namespace separator? I don't think the "." character is used anywhere else in PHP at all, unless I am mistaken. ...

Unsigned int to signed in php

I got a problem with ip2long in PHP5. It appears, that in 32bit OS ip2long returns signed int, and in 64bit OS unsigned int is returned. My application is working on 10 servers, and some are 32bit and some are 64bit, so I need all them to work same way. In PHP documentation there is a trick to make that result always unsigned, but since ...

Prettifying a conversion from m(metres) to feet(') and inches ('')

I'm creating table for defining an individual's BMI. The chart (as yet) doesn't take input (because I want to make the thing work stand-alone, first), but it does show (on parallel axes) the height in both metres and feet/inches. In order to do this I'm defining the metres' start point and range and then converting the defined metres va...

PHP FTP directory listing error

array(1) { [0]=> string(8) "outgoing" } bool(false) array(1) { [0]=> string(8) "outgoing" } bool(false) Is currently being produced by $connect = ftp_connect('example.com'); $result = ftp_login($connect, 'username', 'password'); echo '<pre>'; var_dump(ftp_nlist($connect, '')); var_dump(ftp_nlist($connect, '/outgoing/')...

PHP 5.2 Virtual-like static methods

Hello all, Here is my situation: I have a PHP base class that looks something like this: class Table { static $table_name = "table"; public function selectAllSQL(){ return "SELECT * FROM " . self::$table_name; } } And a subclass that is like this: class MyTable extends Table { static $table_name = "my_table"; } Unfort...

Linking Facebook Connect

Hello guys, I've started working on integrated Facebook Connect with my app. I have a slight lack of knowledge problem though. I can perfectly make it so you log into Facebook Connect on my site, etc, shows your details all FB Connect functions work. But, how do I make it so I can store the facebook user ID into my MySQL database as pa...