php

getting output and exit status from shell_exec()

When doing something like $output = shell_exec("command 2>&1"); collecting the command's stdout & stderr in $output, is there a way to find the command's exit status? One could write the command output to a temp file and then append the exit status, but that's rather clunky. Any better suggestions? ...

empty file problem [solved]

REWROTE: SOLVED Hi there, I currently worked on a simple application with a database, a bunch of controllers, views and a model class. I coded the controllers and inserted the db connections directly E.g. Each controller method has his own PDO to connect to a specific database+table. I refactored this because I had too many active P...

Dynamic return type with type hint in PHP?

For a standard method, I know one can specify return type in the comments such as: /** * Load this entity from the database with the specified primary key. * @param int $Key * @return BaseEntity */ public static function Load($Key) { ... } I would like to have the return type change depending on the subclass. Something like: * @...

Is it feasible to rely on setlocale, and rely on locales being installed?

I was trying to generate a localized date string with strftime, the placeholder I use is %x. The language/locale is setlocale(LC_ALL, array('jp','japanese')), however neither locale was available so it generated a string with improper characters. I then installed the ja_JP.utf8 locale and specified that as the first element in the array ...

Is it a bad idea to return the html code from a function or method?

I have this idea: when someone calls mysite.com/layer1/layer2/something, then I want to start the action called something. That action is simply a file in an actions directory which contains a function. This function takes some context parameters and is supposed to return HTML output. This output, which goes into a variable, will then b...

zend lucene problem with the word "mortgage"

I'm using Porter Stemmer to stem the words, and here's a problem I'm running into: Word "mortgage" is correctly stemmed to "mortgag" Word "mortgagee" is (arguably incorrectly) stemmed to "mortgage" There are approximately 100 documents with the word "mortgage" There is 1 document with word "mortgagee" When I build an index without put...

Is there an database connectivity framework or library for PHP?

I wonder if there's a useful library or lightweight framework only for database connectivity. What I need is something that lets me use a MySQL database with prepared statements in a secure way, without thinking a lot about gcc_magic_quotes and stuff like that. Something object oriented would be nice to have, with some convenience when f...

Page changed in JQUERY

I am trying to found out how to see if a php file has changed and then show a div with saying Page changed in JQUERY ...

instantiating a new class in a loop or not in a loop?

require_once('Class.php'); $myArray = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); // etc which is correct? foreach($myArray as $key => $val) { $class = new Class(); $result = $class->someMethod($val); } or $class = new Class(); foreach($myArray as $key => $val) { $result = $class->someMethod($val); } Edited to be more...

Live Notification Jquery

Can someone lead me down the right way to make a live notifications e.g Knowing when a new Row in Added in Mysql know if a php file has changed ??? how should i go about it? ...

Little help with making this basic search function work (Zend Lucene)

I have two php files so far, test.php: <?php include("../config_conn_fordon_db.php"); include("../config_open_db.php"); // Fix Special Characters mysql_query("SET NAMES 'utf8'") or die(mysql_error()); mysql_query("SET CHARACTER SET 'utf8'") or die(mysql_error()); $root = realpath($_SERVER["DOCUMENT_...

Handling unknown number of values in PHP file

The form that will be submitting the data will have somewhere between 10 and 100 values being sent to the PHP file. The number of inputs is stored in a variable called count within my javascript function but I don't know how to transfer its value to my PHP file. Another idea I had was to have a while loop that detected a null value and...

set_error_handler function not calling autoload

I have the set_error_handler() function set to call a function when there is an error. In that function I have my own implementation of the exception class: function acs_error_handler($errno, $errstr, $errfile, $errline) { throw new acs_exception($errstr, $errno); } This gives me the following error: Fatal error: Cla...

xmlHttp string POST Headers issue

i am trying to pass a string through the XmlHttp method. Let me show you the code: HTML <div id="greetings"> You are voting out <b style="color: #00b0de;" id=roadiename></b>. Care to explain why?<br/><br/> <textarea name="textarea" id="comment" cols="38" rows="7"></textarea><br> <a href="#" id="postmsg" onclick=...

Any easy, noncluttering way to set up "mydomain.com/username" using PHP?

Simply put, when a user wants people to be able to go to their profile, we want them to be able to just say go to mydomain.com/username. The real user page would be at something like mydomain.com/users/page.php?id=1325 which doesn't really help users. The problem: I've been doing PHP for some time, and have never had the need to do thi...

Can I also create new tables or edit table structures with ADOdb?

Does anyone know if this is possible when I use ADOdb? I need to create new tables and edit table structures programmatically (i.e. adding new columns or modifying existing columns). I'm going to use MySQL for sure. ...

Mysql can't perform more than 1 query at a time

When I do: $q = 'insert into movies values("lion king"); select * from movies;'; $result = $db->query($q); echo mysqli_num_rows($result); it says that $result is boolean, not mysqli result. if I check $result like this: if(!$result) echo 'fail'; it outputs 'fail'. Is mysql not capable of handling more than 1 query at a time? How d...

Uploadify Minimum Image Width And Height

So I am using the Uplodify plugin to allow users to upload multiple images at once. The problem is I need to set a minimum width and height for images. Let's say 150x150px is the smallest image users can upload. How can I set this limitation in the Uploadify plugin? When user tries to upload smaller picture, I would like to display some...

Is there a self contained library for serializing PHP data to AMF?

My team has been asked to offer AMF output from our web service to decrease the time spent parsing XML or JSON for Flash modules on the front end. As we have an existing application architecture that we must continue to support in terms of request structure etc, I am not interested in using one of the preexisting AMF RPC frameworks (eg:...

Reset Class Instance Variables via Method

Does anyone know how to reset the instance variables via a class method. Something like this: class someClass { var $var1 = ''; var $var2 = TRUE; function someMethod() { [...] // this method will alter the class variables } function reset() { // is it possible to reset all class v...