php

Could not access php session variable once the tomcat restarts

Hii.. I am developing an applicaton in java which needs to integrate some php files under tomcat server. I did everything successful, but the problem is that when i shutdown tomcat server it shows some error like Exception in thread "JavaBridgeSessionTimer" java.lang.NullPointerException at php.java.bridge.SessionFactory$Sessi...

How do I run phpunit command in Windows command line no matter what directory I am in?

all examples of phpunit I saw run the simple command line tool: phpunit TestClass but when I try the same on a directory other than the xampp php dir, I end up getting an "unknown command..." Is there a way to execute the phpunit command from any directory in the Windows command line? ...

How do I set up an inbound mail controller so users can post to unique email address?

Tumblr (the short form blogging platform) has a feature where you are given a unique email address (for example, [email protected]) that you can email text or images and it automatically formats it into a post for you (as long as the sending email address matches your account email address). I'd let to set up something similar, but sol...

mysql template in php

Hi, I come across this sql code in a php software. What does the #section_filter mean? Is that a valid mysql syntax? or just a templating system? $filterid = ac_sql_select_one(" SELECT id FROM #section_filter WHERE userid = '$ary[userid]' AND sectionid = 'article' AND conds =...

What are the bones of a Powerful CMS

where im working is a company to improve their own market CMS , if u were me and u had the opportunity to build ur own CMS ( revision of existing CMS ) what steps u would take ? as far as i know these things can be most important : template engine ( caching ability ) a php framework ( ZEND) a javascript Framework ( Jquery ) OOP co...

How do you perform Cron job if your hosting does not provide a cron job control panel?

I am using PHP for my application. I have a demo site and need to clean database regularly. I thought it can be done with a cronjob. However my hosting does not provide a cron job cotroll panel. What is the best way to perform cron job? How do you perform it if your hosting does not provide a cronjob control panel? Thanks in advance...

how to extract the exact data from an array in php

i got this array from an database...how to get the exact value attribute...... Array ( [0] => TRowResult Object ( [row] => tests [columns] => Array ( [a21ha:link_0] => TCell Object ( [value] =>testsample ...

Setting a greeting based on user's time (Good morning, good afternoon…)

I'm sort of lost. Can anyone extrapolate on how to implement a basic "good evening" or "good morning" based on the user's time setting? Perhaps PHP will fetch the server time, but I'm looking to greet the site visitor with a time-based appropriate greeting that considers their time of day. E.G.: good morning, good night, good afterno...

Parallel array assignment in PHP.

Most languages make it easy to take an array like [1, 2, 3] and assign those values to variables a, b, and c with a single command. For example, in Perl you can do ($a, $b, $c) = (1, 2, 3); What's the corresponding trick in PHP? [Thanks so much for the lightning fast answer! I know this is a trivial question but all the obvious goog...

ADODB to PDO quick switch

Hi! In past i use adodb for mysql in php. Now i wont to use PDO. How can i quick switch from adodb query to pdo using one connection to datebase? ...

error in compiled in swig for connect c with php

swig -php example.i This will produce 3 files example_wrap.c, php_example.h and example.php. The first file, example_wrap.c contains all of the C code needed to build a PHP extension. The second file, php_example.h contains the header information needed if you wish to statically link the extension into the php interpreter. The third fil...

How to build a 'related questions' engine?

One of our bigger sites has a section where users can send questions to the website owner which get evaluated personally by his staff. When the same question pops up very often they can add this particular question to the Faq. In order to prevent them from receiving dozens of similar questions a day we would like to provide a feature si...

How to update a user's Facebook status?

Hi, I looked at many similar questions here at Stackoverflow.com and searched in Google but still could not find an answer, so I am posting this new question. I have a 3rd party PHP5 website in which users can write a short message. I want to have the ability for the user to click a button to share that message as a facebook status. It ...

Add more output smarty html option

{html_options values=$row.milestone_id output=$row.title output=$row.title} hi folks,how to add more $output in smarty html option ? ...

Can I override the PHP built-in function echo()?

I recently looked at my source code and it was a real mess. my php source: echo '<h1>Rar<h1>'; echo '<span>Rar</span>'; echo '<p>Rar</p>'; and when I view the browser source for the page rendered: <h1>Rar</h1><span>Rar</span><p>Rar</p> is there a way for me to override echo so that every output would end with a newline, something ...

Zend Framework: What are the differences between init() and preDispatch() functions in controller objects?

I think the order of execution is init(), preDispatch() and then action() is called. Should I initialize my variables, which are common among all actions, in init() or preDispatch()? I've seen people using both functions for initialization. Probably as the name suggests it should be done in init() but then what kind of stuff would go i...

Matching everything between html <body> tags using PHP

I have a script that returns the following in a variable called $content <body> <p><span class=\"c-sc\">dgdfgdf</span></p> </body> I however need to place everything between the body tag inside an array called matches I do the following to match the stuff between the body tag preg_match('/<body>(.*)<\/body>/',$content,$matches); b...

.htaccess deny access to specific files? more than one

I am able to disable access to a file with .htaccess, but I don't know how to disallow multiple files to be viewed (directly, not from includes) They are .php so I can't disable a file type (like the only tutorials online say..) <FILES ... ? </FILES> Or something.. For example "home.php, file.php , test.php" how do I disallow acces...

APC progress bar show sticky percentage

I have problem using APC progress bar I follow from this example http://www.johnboy.com/php-upload-progress-bar/ I modified the code and it works. The problem is it will display the last percentages after I refresh the page. Let say a file is just finish uploaded at 100%, it will display 100% after I refresh the page. If I cancel halfwa...

[Mysql] Inline Query vs Stored Procedures to use in PHP

I have been using inline query statements within my model of my application... As of now many people said that stored procedures would be a good practise... I have the following question How to use MySql stored procedures in PHP Codeigniter? What are the advantages of using Mysql stored procedures? ...