(Before you down mod it: nope, this is not homework)
I have a web system which has a classical parent-children menu saved in a database, with fields id as the PK, and parent_id to pointing to the owning menu. (Yes, I know this doesn't scale very well, but that's another topic).
So for these records (id-parent_id pairs):
0-7 0-4 4-9 4...
I find myself drawn to the Parsing Expression Grammar formalism for describing domain specific languages, but so far the implementation code I've found has been written in languages like Java and Haskell that aren't web server friendly in the shared hosting environment that my organization has to live with.
Does anyone know of any PEG l...
I want to run text through a filter to ensure it is all UTF-8 encoded. What is the recommended way to do this with PHP?
...
I have a code snippet written in PHP that pulls a block of text from a database and sends it out to a widget on a webpage. The original block of text can be a lengthy article or a short sentence or two; but for this widget I can't display more than, say, 200 characters. I could use substr() to chop off the text at 200 chars, but the re...
I can't seem to find much documentation on x_sendfile or example code for PHP (there is some rails code). Anyone use it before and would mind giving a quick snippet of code and a brief description?
...
I was writing a database handler class in PHP using the mysqli class and prepared statements. I was attempting to print out the result. It didn't work right off the bat so I decided to do some debugging. I tried to use the num_rows() method from the mysqli_statement class, but it kept returning 0. I decided to write a small porti...
I have video durations stored in HH:MM:SS format. I'd like to display it as HH hours, MM minutes, SS seconds. It shouldn't display hours if it's less than 1.
What would be the best approach?
...
I have tried:
Xdebug and Eclipse. Eclipse launches a web browser, but the browser tries to access a non-existent file in Eclipse's .app bundle.
Xdebug and NetBeans. It does a little bit better; a browser opens a page in /tmp which says "Launching. Please wait…" but nothing happens beyond that.
Xdebug and debugclient, the CLI tool which...
The title is pretty much self explanatory. Given two dates what is the best way of finding the number of week days using PHP? Week days being Monday to Friday.
For instance, how would I find out that there are 10 week days in between 31/08/2008 and 13/09/2008?
...
Can you explain the difference between == and ===, giving some useful examples?
...
Hi everyone,
I am trying to use Zend_Db_Select to write a select query that looks somewhat like this:
SELECT * FROM bar WHERE a = 1 AND (b = 2 OR b = 3)
However, when using a combination of where() and orWhere(), it seems impossible to use condition grouping like the above.
Are there any native ways in Zend Framework to achieve the ...
I'm looking for an efficient way (using PHP with a Mysql Database) to suggest alternative spelling for a query.
I know I can use services such as Yahoo's Spelling Suggestion but I want the suggestions to be based on what is currently available in the database.
For example: The user has to fill a form with a "City" field, and I want to...
We recently debugged a strange bug. A solution was found, but the solution is not entirely satisfactory.
We use IntSmarty to localize our website, and store the localized strings in a database using our own wrapper. In its destructor, IntSmarty saves any new strings that it might have, resulting in a database call.
We use a Singleton ...
Just want to know what is better way to get start developing faccebook app?Any tutorial recommnedation?And which is better to start up -php or rails?
...
I have a script that works fine on my test server (using IIS6). The script processes an ajax request and sends a response with the following line:
header( 'application/javascript' );
But on my live server, this line crashes the page and causes a 500 error.
Do I need to allow PHP to send different MIME types in IIS7? If so, how do I do...
I need a way to easily export and then import data in a MySQL table from a remote server to my home server. I don't have direct access to the server, and no utilities such as phpMyAdmin are installed. I do, however, have the ability to put PHP scripts on the server.
How do I get at the data?
I ask this question purely to record my way ...
Hello,
I have a old website that generate its own RSS everytime a new post is created. Everything worked when I was on a server with PHP 4 but now that the host change to PHP 5, I always have a "bad formed XML". I was using xml_parser_create() and xml_parse(...) and fwrite(..) to save everything.
Here is the example when saving (I read...
I am a PHP Developer, but I am confused on how to connect to a remote Oracle database instance from PHP. I simply need to query a read only database and get some data. Do I need to have the Oracle Instant Client or the extension is enough? Thanks.
...
I am confronted with a new kind of problem which I haven't encountered yet in my very young programming "career" and would like to know your opinion about how to tackle it best.
The situation
A research application (php/mysql) gathers stress related health data from users. User gets a an analyses after filling in the questionnaire. Valu...
In php I have open a .php file and want to evaluate certain lines. Specifically when the $table_id and $line variables are assigned a value.
Within the text file I have:
...
$table_id = 'crs_class'; // table name
$screen = 'crs_class.detail.screen.inc'; // file identifying screen structure
...
amongst other l...