affiliate_link

Friday, August 28, 2009

PHP global arrays


The Global Array List


Old Form New Form Description
-- $GLOBALS[] The complete list of all global variables, including user defined variables at the global level.
$HTTP_GET_VARS[] $_GET[] All variables received as part of a query string in the requesting URL, or HTML form data transmitted using the GET method.
$HTTP_POST_VARS[] $_POST[] All variables recieved as an inline posted data set, normally through using the POST method in an HTML form.
$HTTP_POST_FILES[] $_FILES[] References to all files received, most commonly from HTML forms, using the POST method.
$HTTP_COOKIE_VARS[] $_COOKIE[] Any cookies returned from the client. The index key name matches the cookie name.
-- $_REQUEST[] A more recent addition that stores all user variables, including elements from the $_GET[], $_POST[], and $_COOKIE[] arrays. Prior to PHP4.3, this also includes the $_FILES[] array.
$HTTP_SERVER_VARS[] $_SERVER[] Information about the server session and the HTTP connection with the client.
$HTTP_ENV_VARS[] $_ENV[] Information about the server environment and system defined values.
$HTTP_SESSION_VARS[] $_SESSION[] IF PHP is being used for session management, this array is to store any session variables that need to be stored on the server between calls from the client.




MySql - InnoDB vs MyISAM

Most people who use MySQL know that MyISAM and InnoDB are the two most-common database engines available with the popular open-source database provider.

Storage Engine

The storage-engine is what will store, handle, and retrieve information for a particular table. As hinted by the opening of this article, there is no be-all end-all solution to every or even most cases. Each has very specific pros and cons that by design can not be all-inclusive of each other.

What is a full text search in mysql?

According to the MySQL manual, Full-text is a “natural language search”; it indexes words that appear to represent the row, using the columns you specified

MySQL has had FULLTEXT searching in one form or another since version 3.23.23. FULLTEXT indices in MySQL allow database administrators and programmers to designate any character-based field (CHAR, VARCHAR, or TEXT) as a FULLTEXT index, which allows for complex text searching against data stored in those fields.

Tuesday, June 16, 2009

How Can I Use Javascript to Allow Only Numbers?

function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;

return true;
}

Add the following to the onkeypress event of your text box

return isNumberKey(event)

Wednesday, May 6, 2009

What is Referential Integrity?

Referential integrity is a database concept that ensures that relationships between tables remain consistent. When one table has a foreign key to another table, the concept of referential integrity states that you may not add a record to the table that contains the foreign key unless there is a corresponding record in the linked table. It also includes the techniques known as cascading update and cascading delete, which ensure that changes made to the linked table are reflected in the primary table.

Reference: http://databases.about.com/cs/administration/g/refintegrity.htm

Friday, April 17, 2009

Stop Youtube from displaying related videos once playback of the initial video starts

To stop displaying related videos we can add a parameter (rel=0 for stop displaying) to the url of the embedded code provided by you tube. See example below

http://www.youtube.com/v/u1zgFlCw8Aw&fs=1&rel=0

For complete list of parameters check the following Google API site:

http://code.google.com/apis/youtube/player_parameters.html

Thursday, April 16, 2009

Finding duplicates with SQL?

Suppose Col1 is the field name for which you want to find duplicates:

Select Col1, Count(Col1) as count
from table1
group by Col1
having Count(Col1) > 1

.