php

Use of 'standalone parentheses'

I just answered a question where I advised removing parentheses around a statement and was asked why, to which I had no answer when I realised that it caused no errors/warnings. I could only cite bad practice. But maybe I'm the one missing something... I did my own tests: (print('!')); // Outputs '!' ((print('!!'))); // Outputs '!!' (1...

Error after redirection using CakePHP

I have created some code called LoginController. Whenever Admin gets successfully logged in I redirect the page to index. However, I got an error like "problem on loading page". This is my code: <?php class LoginController extends AdminAppController { var $name = 'Login'; var $uses = array('Admin.Login'); var $sessionkey= ''; /*functi...

Can we get the Directory's Modified time and size i.e. stats?

Can we get the Directory's Modified time and size i.e. stats in php? How? ...

Cannot modify header information - headers already sent by

<?php require_once 'wordwrap.php'; $text="Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum"; $im=imagecreatefrompng('testing.png'); $arr=word($text); $white = imagecolorallocate($im,255,255,255); $grey = imagecolorallocate($im, 128, 128, 128); $font='arial.ttf'; $m=121; for($i=...

How to pass value to controller?

When I try to pass the url value to the controller action, action is not getting the required value. I'm sending the value like this: function value(url,id) { alert(url); document.getElementById('rating').innerHTML=id; var params = 'artist='+id; alert(params); // var newurl='http://localhost/songs_full/public/eslres...

PHP Performance Question (readable code or not, web app)

I wondered if I should write my code clean and readable or rather small and unreadable... Or should I write it readable and then compress it afterwards when I'm publishing it on the web? Ps. I'm building a web app, the faster, the better! Thanks_ ...

Problem passing strings with PHP post

Hi Guys, Basically I'm developing a (very) simple search engine. You can enter a search term and you are taken to the results page - which works fine. However on the results page, I have a button that will take you to the next 10 results: where $term is the $_POST['term'] value. echo "<input type='hidden' name='term' value='" . $term ....

how to dynamically change the max upload file limit in php?

I want to change the max upload file limit dynamically. means by not changing the php.ini file on server. Whenever user had uploaded more then 2 mb then my upload limit should be change. I want to do all this through php. Thanks in advance. ...

How to convert numbers to words in php

Is there a function in php wherein you can convert the number 12 to its equivalent in a month. For example if the mysql database stores digits and not words for dates. how do you convert the number 12 into the word december? ...

php smarty not passing to browser unless logged in.

I'm not the best at understanding these things with php and smarty, but this is really annoying. On: http://www.euroworker.no/order, there is meant to be a display of the amount of tax included in the price like: Tax (25%): 772,- Totalt: 3861,- But unless the user has logged in or created a new account, the tax doesn't displa...

Httpd Process High memory usage and slow page loads

Hello all, I am running wampserver on my windows vista machine. I have been doing this for a long time and it has been working great. I have completed loads of projects with this setup. However, today, without me changing anything (no configuration etc) only PHP code changes, I find that every time I load pages of my site (those with u...

soap response to xml (simple_xml)

Hi i am trying to convert a soap response to XML. Soap has an envelop and a body <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <soap:Body> When try to convert $responseXML = simplexml_load_string($string);...

mcrypt_generic vs mcrypt_encrypt

Does anyone know the difference between mcrypt_generic and mcrypt_encrypt when it comes to encryption in PHP? ...

How to update mysql data when using explode

I have this code to load the month of the birthday that corresponds to the id number: < ?php $query = "SELECT DISTINCT BIRTHDAY FROM student WHERE IDNO='".$_GET['id']."'"; if($result = mysql_query($query)) { if($success = mysql_num_rows($result) > 0) { ?> <select title="- Select Month -" name="mm" id="...

symfony + doctrine + inheritance, how to make them work?

I am beginning to work with Symfony, I've found some documentation about inheritance. But also found this discouraging article, which make me doubt if Doctrine handles inheritance any good at all... Has anyone find a smart solution for inheritance in Symfony+Doctrine? As an example, I have already structured the database something lik...

PHP static objects giving a fatal error

I have the following PHP code; <?php component_customer_init(); component_customer_go(); function component_customer_init() { $customer = Customer::getInstance(); $customer->set(1); } function component_customer_go() { $customer = Customer::getInstance(); $customer->get(); } class Customer { public $id; stati...

php/as3 regex to split multiple json in one

For example I have this string of 2 json objects: {"glossary": {"title": "example glossary"}, "aaa": "1212"}{"adada": "faka"} I want to split it in the array for PHP and Actionscript 3 Array ( [0] => '{"glossary": {"title": "example glossary"}', [1] => '{"adada": "faka"}' ) What is the best method to do it. Edit: I don't ne...

Running PHP,MySQL and apache in Ubuntu 10.04 LTS

Hello all, I have installed native apache and mysql,php in my linux server. I tried a page using phpinfo() and it worked.But when I try my own pages, the execution of the page stops when it comes to the php tag, even the css tag following it doesn't come to the browser. Please help me how to fix this issue.. Thanks in advance ...

a reusable query with modifications?

i'm using this mysql query alongwith php to search for multiple keywords: $query = "SELECT cQuotes, vAuthor, cArabic, vReference FROM ".$table." WHERE ("; $countFields = count($arrayFields); while ($a < $countFields) { while ($b < $countSearch) { $query = $query."$arrayFields[$a] LIKE '%$arraySearch[$b]%'"; $b+...

C & PHP: Storing settings in an integer using bitwise operators?

I'm not familiar with bitwise operators, but I have seem them used to store simple settings before. I need to pass several on/off options to a function, and I'd like to use a single integer for this. How can I go about setting and reading these options? ...