php

cache mysql results and requery only if something changes

Is it possible to query the database only once while the page loads in PHP. Somehow store these results and display it to user on subsequent reports. Is there any way to determine if something is changed in the database so that we can connect to DB only then to fetch new/changed results? Please give me some idea. Thanks. ...

Building PHP Competencies in an organization

Hi, This is not really a technical programming question, but has more to do with best practices and programming / project management processes. Here's some background information: I'm a consultant with an agile (scrum) software development company that specializes in the Java, J2EE, Flex technology stack. Here it is generally perceiv...

Dead.letter email. Same domain name, different mail server

I have a server setup "myserver.com" and I'm trying to send emails from a PHP/Apache application on this server. The host name is set to "myserver.com" and I can send emails to anyone outside of the myserver.com domain. We are using a separate server/service and the problem is when I try to send emails to anyone on the myserver.com dom...

Can regex do this faster?

I want to capitalise each word and combine it into 1 word, e.g: home = Home about-us = AboutUs Here is the function I use at the moment, can regex do this better or more efficient? public function formatClassName($name) { $name = str_replace('-', ' ', $name); $name = ucwords($name); $name = str_replace(' ', '', $name); retur...

Insert into MySQL tables with JOIN?

I have these tables: http://stackoverflow.com/questions/2104063/my-final-mysql-db-could-someone-check-if-the-tables-are-correctly-made How can I make an Insertion of an ad here? Is join used on insert also? Thanks Clarification: I need to insert values into multiple tables here, and don't know how to do it else than using multiple IN...

Zend Server Version?

How can I receive the Zend Server version by a PHP script running on this Zend Server? phpinfo() and the commandline php -v does not tell the Zend Server version! ...

json_encode remove quotes from keys?

If I use json_encode() on an array like this: return json_encode(array( 'foo' => 'bar')); The return is: {'foo' : 'bar'} The key is passed as a literal, and that is tripping up my script. What I really need is: { foo : 'bar' } Does json_encode do that or do I have to strip the quotes out myself with some ugly regex? ...

Remove with regex the end portion of a string

I'm trying to remove from a string everything start with / char, so if I have my_value/j/im<b*+èo[/h>e\ylo I'd like to remove the string /j/im<b*+èo[/h>e\ylo and return only my_value. I thought to use something with str_replace but I'm not a great regex programmer and I'm doing practise with php. function clean_value ($value) { r...

Adding a space between two linked labels

This might be the silliest question ever. But how do I get to put a space between the Edit and the Delete labels? echo " <a href=\"update.php?id=" . $id . "\"> Edit </a>"; echo " <a href=\"confirm.php?id=" . $id . "\"> Delete </a>"; I tried putting echo " "; in between but doesn't work. The underline is straight from Edit to ...

PHP Depend and @package-annotations

Similar to What's the point of package annotations?, I'm running pdepend against a section of our source code, looking for problems. However, it spits out the following: The parser doesn't detect package informations within the analyzed project, please check the documentation blocks for @package-annotations or use the --bad-documentati...

HTACCESS Redirect folder

All, I want to redirect all traffic that comes to http://mysite/ to http://mysite/public folder. Currently I am doing this using the below in an .htaccess file and it works for the root directory. But if I browse to http://mysite/application, it doesn't redirect and shows the directory listing. I want all traffic regardless of what fold...

PHP - How to get the element before the last element from an array ?

How can I get the element before the last element from an array in PHP5 ? ...

Calling JavaScript within Php block and vice-versa

echo "<a href=#> Delete </a>"; Whenever a user hits Delete, a javascript function should be called for confirmation. Somewhere in the Javascript function, php code should be used for delete operation. How do I do that? Use something like "some php code goes here" and "some javascript function();" for me to know where to put what. Thank...

Google code php clone

I am looking for a google code/*beanstalk* php clone that I could install on my server Does that exists ? I have tried Indefero, but it is a big pain to install it. ...

Should I use AI on these fields in MySQL?

I have this db below. I wonder how I should use the ID to identify each record. Everything is connected from the classified_table! Two Questions: Should I use AI on every PK in this case? Could somebody give me the FULL code for selecting an entire classified from only an ad_id ("bmw_330ci_8939483" for example)? I am new to normalize...

Drupal: Associating grouping more than one CCK field.

I have an article content type with a node reference CCK field that links to other articles (related articles) . I need to add a text field for each node reference that allows an admin to specify "why it's related". How do I go about this in D6? Articles can be related with other articles so it makes sense to have the "why it's relat...

problem in showing 3 images in a row

hey guys , i know this is a stupid question but i hanged in solving it i wrote a block of php code to show images from mysql echo "<table><tr> "; while($cat = $db->sql_fetchrow($catinfo)) { echo ' <td> <ul id="three-col" class="press"> <li> <div class="post-content"> <a class="zoom...

How to document class properties in PHP 5 with phpDocumentor

Take in consideration the following PHP 5 class: class SomeClass { //I want to document this property... private $foo; function __construct() { } public function SetFoo($value) { $this->foo = $value; } public function GetFoo() { return $this->foo; } } How in phpDocumento...

PHP how to tell vocabulary type in context

What I want to be able to do is tell if a word in a sentence is a noun, adverb, adjetive, etc.. I looked into FreeLing, and a few other open source projects that I could find that are able to do this, just wondering if there is one that works with PHP natively, if not, do you have any suggestions on other projects like FreeLing that mig...

TinyMCE in PHP whit sub.domain.com

Hello all i have this config file http://pastebin.org/85981 the problem is before i have change $mcImageManagerConfig['filesystem.rootpath'] from simplecms.info to cms.schemecloud.com its have no problems, but after i have change the domain its giving problem when i select the URL its only comming whit .com and not cms.schemecloud....