Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts
Tuesday, January 29, 2013
Clearing cache for druplal node
cache_get('content:12345:23456', 'cache_content'); # get the data
cache_clear_all('content:nid:vid', 'cache_content') # clear that specific nid/vid combination
cache_clear_all('content:nid', 'cache_content', TRUE) # clear all cached revisions of that nid
Monday, June 29, 2009
PDO (PHP Data Objects) && Prepared Statements
A prepared statement s, essentially, the template of an SQl statement that has been pre-parsed and compiled and is ready to be executed by passing it the appropriate date.
Steps:
1. Create Prepared Statement (replacing your data with a set of markers uch as question marks, or named entities.
2. Load Data in the statement
3. Execute
// Example
$clean = array();
if (ctype_al[ha($_POST['username']))
{
$clean['username'] = $_POST['username'];
}
// Set a named placeholder in the SQL statement for username
$sql = 'SELECT * FROM users WHERE username = :username';
// Assume the database handler exists; prepare the statement
$stmt = $dbh->prepare($sql);
// Bind a value for the parameter
$stmt->bindParam(':username', $clean['username']);
// Execute and fetch results
$stmt->execute;
$results = $stmt->fetchAll();
Thursday, May 28, 2009
PHP Defined vars, functions, contstants
When debugging PHP application - it's convinient to print defined values on the
screen. PHP has build in functions:
- get_defined_vars();
- get_defined_functions();
- get_defined_constants();
screen. PHP has build in functions:
- get_defined_vars();
- get_defined_functions();
- get_defined_constants();
Tuesday, April 14, 2009
PHP objects, Patterns, and Practice

The book is about OOP and design patterns specifically for PHP5. It also includes chapters for CVS, PHPUnit, Phing, Pear and phpDocumentor. I pleased with reading and information in the book. The book is a good programmer reference.
Thursday, March 26, 2009
PHP Logic & Bit Operations
Here is good example of bit operations in PHP:
Bit Operations in PHP
Bit Operations in PHP
Subscribe to:
Posts (Atom)