Tuesday, March 6, 2012

Disable Input Type Text using JQuery

Hi Friends,

Here is how you do it..
Disable a text box which is given id as username.
$("input#username").attr('disabled','disabled');


Enable a text box which is given id as username.
$("input#username").removeAttr('disabled');


Cheers!!!
Ravi Kumar Gupta

Saturday, March 3, 2012

[PHP] Error Reporting : Turn off Warnings/Errors/Notices

Hi Friends,

Recently I was writing a simple personal site. I had to add some php script as well to communicate with mysql server. For any error, warning, I used to see messages in browser which can be frustrating at times. If you are looking for a way to disable those messages.. here it is.

We are going to use error_reporting($level) function of php. Syntax is:
int error_reporting ([ int $level ] )

Write this in php file where you want.
<?php
// Turn off all error reporting
error_reporting(0);

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);

// Report all PHP errors (bitwise 63 may be used in PHP 3)
error_reporting(E_ALL);

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);

?>

Thats how you do.. Cheers!!!

-Ravi -aka- D'Maverick