php5

Does it make sense to check variable before initalizie it?

Is there any advantage if i check if the object already exists in an language like php? /** * User object * @var My_Model_User */ protected $user = null; /** * Setup */ public function __construct() { if ($this->user === null) { $this->user = new stdClass(); } ...

Create excel file using PHP compatible for 2007 and 2003

am creating a .xls file using PHP fopen write and append the contents to the file. Works fine with Excel 2003. But excel 2007 showing a alert before opening as un supported type. If i create file with .xlsx extension , it is not opening in 2003. Is there any standard way that works fine in both 2003 and 2007 versions . ...

Is this a correct utm.gif query?

I was wondering if i build this google analytics query the right way. I am not sure about the 'utmcc'-Part. 0 => string 'http://www.google-analytics.com/__utm.gif?utmwv=4.5.7' (length=53) 1 => string 'utmn=738025229' (length=14) 2 => string 'utmhn=www.mydomain.de' (length=15) 3 => string 'utmcs=ISO-8859-1' (length=16) 4 => str...

What is difference between creating a file with fopen and generating file with headers

One Way am creating an xls with fopen("test.xls") . Using fwrite i write xls and readfile give me the file. Second Way I generating xls with putting header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header ("Pragma: no-c...

passing uploaded files to another part of the script for onward processing

Hello guys, I have searched the forum but the closest question which is about the control stream did not help or i did not understand so i want to ask a different question. I have an html form which uploads multiples files to a directory. The upload manager that handles the upload resides in the same script with a different code which I...

Kohana 3 Share admin between multiple projects

Hi All, Is it possible to share admin area (having admin controllers,modules and views) among multiple projects. I want to design admin module having common functionality like admin user-role management, modules management etc. that will be shared with multiple projects. There can be possibility one of project may hold custom admin func...

How moving from PHP5.3 to Java 6 EE ?

Hi all, I'm a Web 2.0 quite satisfied coder using mainly PHP5 in my webapps (small-medium sized), I find that PHP is supported, widespread, extensible, quite fast and simple. I can say I'm a PHP advanced coder, I'm able to code in OOP, MVC, Zend FW, memcached, ImageMagick and other stuff. But... I heard << Java 6 EE is also a good optio...

php code displaying on web page instead of working behind the scene

Hi, I have an index.html in my wampserver www directory. On this html, there is a link for a user to upload file. When I hit the link, I select files to upload but instead of the uploadmanager.php which i have tested in my eclipse debugg environment to work, it displays the some part of the code on the web page without doing anything t...

How can i write data into an excel using PHP

I have .xls file. How Can i write or append content to the excel using PHP fwrite(). In waht format i write to that. When i try using fwrite its showing an error message in excel 2007 what seperator i can use? Is it possible with out excel classes ...

Question mark in URL for PHP variables makes the link broken. Any idea why?

I don't know what changed in the past--this used to work: Accessing a URL on my server like the following, doesn't work: http://www.domain.com/folder/file.php?variable=a&amp;variable2=b I'm getting a "Not found The requested address 406.shtml was not found on this server." message. However, if I access this, it works: http://www.domai...

Can PHP5 SOAP generate multiple namespaces?

I'm trying to send a PHP SOAP request that requires the following format: <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:S...

How to make custom sql log in symfony 2 and doctrine 2?

I need to add sql logging to work in native WebProfileBundle. When I do one default connection in application config, I see the sql queries in my log. But my application uses many connections to many db servers, so I can't add all the possible connections to config file. I create runtime connections, i.e.: $config = array( 'us...

Redirection after session expiry for an ajax/json call

Hello I am working on getting data from database by sending a piece of value using the getJSON method of JQuery library, to a PHP function which fetches data from the database. The data is then put into an name:value pair array and is json encoded and returned/echoed. This would help jQuery to populate the required HTML elements with the...

Problem with short date format in php

Hi, I have problem with date function in php. If I supply string in format "d.m.y" for example "01.01.01" it gets rendered as todays date which means that php gets confused. I found: Note: The "Day, month and two digit year, with dots or tabs" format (dd [.\t] mm "." yy) only works for the year values 61 (inclusive) to 99 (...

CodeIgniter Callback Problem

I have an application that allows users to create forms and assign validation to each field (think http://www.phpform.org/ or http://wufoo.com/). I can easily get each field’s name and label from the database, as well as the array of associated validation rules. Say, for example, I wanted to apply a blanket rule of “required” for all of...

How can i check download window is prompted?

I have a search page. On clicking search it will show a jquery modal with processing image and redirect to results page. I have download functionality also in the search page.If i select download option, the result may vary to 1 kb to 25 mb , and i cant put a timer to close the modal window. Is there any way to find the download is...

can any one show how to put HTML in Heredoc Syntax

How do put htmlcode in heredoc syntax. With in this HTML i May have some PHP Variables needs to be interpreted and Some PHP loops needs to be executed .How Do i do all this can any one show an example $con = <<<EOC <style type="text/css"> .tddata {color:#330000;border-width:0px;font-family:Arial;font-size:12pt;font-weight:bold} .tdhe...

Deprecated method errors with Akelos framework and xampp

Hi folks, I am trying to install Akelos latest version in Xampp latest version. and I get the following deprecated method errors, Deprecated: Assigning the return value of new by reference is deprecated in D:\xampp\htdocs\project\app\controllers\framework_setup_controller.php on line 229 Stacktrace (most recent call first): File: D:\A...

nl2br second parameter doesn't work

This: var_dump(nl2br("aaa\naaa", false)); Outputs: NULL I am using PHP Version 5.2.13. Doctype is: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; What am I doing wrong? ...

Help SOAP PHP Error VersionMismatch

Hello I have the following code : $enllaç = "http://preproduccio.www14.gencat.cat/jov_titus/AppJava/services/EscolesWebService?wsdl"; $aOptions = array( 'location' => $enllaç, 'uri' => 'http://tempuri.org/', 'soap_version' => SOAP_1_2 ); try { $client = new SoapClient($enllaç, $aOptions); $param = array('LoginInfo' =...