Default MySQL DATE Column is in '2012-07-18 10:20:32' format
We must be using some input box or calender script in Webpages to enter a date .
If the Date inserted is not in Format of MySQL it wont get saved to DB.
So when we insert a Date Value from PHP into a database column we need to format according to MySQL.
For this we can use MySQL STR_TO_DATE().
Syntax: STR_TO_DATE(Str,format);
Str is the DATE string and Format is the format of Str.
Please remember this function always return a DATE in 'YY-MM-DD' format.
eg:
SELECT STR_TO_DATE('18-7-2012','%d-%m-%Y')
prints : 2012-07-18
we mention is the second argument the format in which we pass the Str which has a date.
if we pass the Str in '2012/07/18' (ie YY/MM?DD)
SELECT STR_TO_DATE(' 2012/07/18 ','%Y / %d / %m')
prints : 2012-07-18
How to enable showing queries in Code Igniter profiling?

Hello Web,
Its been now a while using CodeIgniter (PHP Framework), but i have been keep finding new stuff when face some dramatic problem. I have to enable a profiling in one my work and come accross a problem that profiling not showing any queries even database is selected.
To solve this problem goto system/database/DB_driver.php look for :
var $save_queries= FALSE;
Set save_queries variable from FLASE -> TRUE so your new settings will be:
var $save_queries= TRUE;
It will now show a queries into profiling.
Enjoy Googling.
:D
Vertrigo server installation
Vertrigo Server Installation Procedure:
Step 1:First of all download the latest version of vertrigo web server from this link Download Vertrigo . To download the latest version click on GET THE LATEST VERSION.
Step 2:
After download, double click on that file and then click next, then click on I agree. Then select the destination folder such that I select D folder like the picture.
Step 3:
Install the software by clicking next. Your work is done. You will see a Vertrigo server icon in your desktop. Double click on this icon and the server will run in your computer.
Like the above picture you can shutdown or start, stop Vertrigo server. PHP environment creation is done now it is time to write your first PHP code.
Enable Windows Authentication in a PHP website
Hosting your PHP site in IIS server is easy way to enable Windows Authentication.
Let's see How to install PHP 5.3 on IIS 7
I downloaded PHP for windows from http://windows.php.net/download/
Run the exe and start installation.
Then click next and accept the terms and conditions go next.
Then select IIS FastCGI option.
Select features and extensions you want.
There is an another tool called PHP manager.If u install it you can easily change PHP configuration.
I download that software from http://phpmanager.codeplex.com/
After installing it appears in IIS.You can change configurations such as php.ini configurations enable disable extensions etc.
Now go to authentication window by clicking authentication icon.
Then you can see authentication types. Right click on Windows Authentication and click Enable.
Now you can use server variables to get logged user name.
$userId=$_SERVER['REMOTE_USER'];
It will return YOUR_DOMAIN\USERNAME
Tipo de datos Booleanos en Php
Este es el tipo más simple. Un boolean expresa un valor de verdad. Puede ser TRUE or FALSE.
nota: El tipo booleano fue introducido en PHP 4.
Sintaxis:
Para especificar un literal booleano, use alguna de las palabras clave TRUE o FALSE. Ambas son insensibles a mayúsculas y minúsculas.
<?php
$foo = True; // asignar el valor TRUE a $foo
?>
Usualmente se usa algún tipo de operador que deuelve un valor boolean, y luego éste es pasado a una estructura de control.
<?php
// == es un operador que prueba por
// igualdad y devuelve un booleano
if ($accion == "mostrar_version") {
echo "La versión es 1.23";
}
// esto no es necesario...
if ($mostrar_separadores == TRUE) {
echo "<hr>\n";
}
// ...porque se puede escribir simplemente
if ($mostrar_separadores) {
echo "<hr>\n";
}
?>
Conversión a booleano
Para convertir explícitamente un valor a boolean, use el moldeamiento (bool) o (boolean). Sin embargo, en la mayoría de casos no es necesario usar el moldeamiento, ya que un valor será convertido automáticamente si un operador, función o estructura de control requiere un argumento tipo boolean.
Cuando se realizan conversiones a boolean, los siguientes valores son considerados FALSE:
• el boolean FALSE mismo
• el integer 0 (cero)
• el float 0.0 (cero)
• el valor string vacío, y el string "0"
• un array con cero elementos
• un object con cero variables miembro (sólo en PHP 4)
• el tipo especial NULL (incluyendo variables no definidas)
• objetos SimpleXML creados desde etiquetas vacías
Cualquier otro valor es considerado TRUE (incluyendo cualquier resource).
aviso : ¡-1 es considerado TRUE, como cualquier otro número diferente a cero (ya sea negativo o positivo)!
<?php
var_dump((bool) ""); // bool(false)
var_dump((bool) 1); // bool(true)
var_dump((bool) -2); // bool(true)
var_dump((bool) "foo"); // bool(true)
var_dump((bool) 2.3e5); // bool(true)
var_dump((bool) array(12)); // bool(true)
var_dump((bool) array()); // bool(false)
var_dump((bool) "false"); // bool(true)
?>
What is PHP?
PHP is a popular programming language for extending web pages with dynamic features. It is using small and big company, big project or very small project. It has wide-range usability. Youtube, Facebook and Joomla is written with PHP.
Php is powerfull and free. So, Everyone can use it for commercial. You can run your PHP script most of OS. Mac, Windows or Unix. You must just configure your server for PHP.
Php can be use with MySQL, MSSQL or other database. You can create your own dynamic web site in short time.
Here is simple PHP example;
<?php
/**
* @author PCoder
* @copyright 2009
* Php Hello World
*/
echo("Hello World "); /* Result: Hello World */
Print("Hello World "); /* Result: Hello World */
/* Define a var for Hello World */
$var = "Hello World ";
echo $var; /* You can use this : echo($var); */
print $var; /* You can use this : print($var); */
?>
Introduction
This is a step-by-step tutorial to build a multithreaded daemon in PHP. I will point out several problems caused by a greedy implementation and will give some ways to solve them. I will also have a look at which functions are provided by PHP, what are their advantages and their drawbacks, and how to use them. I will finally give a working implementation of a class that would expose every functions needed to run such a daemon. The implementation will be written in PHP5.
Below are the steps of this tutorial :
- Introduction (this part)
- Why to use a daemon ?
- What is provided by PHP to handle multithreading ?
- Roots of a conceptual implementation
- The basic implementation of the multithreading class
- Limitations of the basic implementation and future work.



