Sunday, February 17, 2008

php tutorials

mysql_fetch_row ::Return row as aan enumrated array and each line contain a unique ID .example.
$result=mysql_query($query);
while($row=mysql_fetch_row($result))
{
print "$row[0]";
print "$row[1]";
print "$row[2]";
}

mysql_fetch_array ::Return row as anassociative or an enumrated array or both which is default .you can refer to outputs as databases fieldname rather then number .example.
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
print "$row['name']";
print "$row['address']";
print "$row['city']";
}

mysql_fetch_object :: it return as an object on the place of array.

$result=mysql_query($query);
while($row=mysql_fetch_object($result))
{
print "$row->name";
print "$row->address";
print "$row->city";
}


ceil() func. gives nearest max values of passing value.

floor() func. gives nearest min values of passing value.

$var=7.5;
$c_var=ceil($var);

echo $c_var; // Outputs 8


$var=7.5
$c_var=floor($var);

echo $c_var; // Outputs 7


Examples of IMAP Functions:

1. imap_list : Read the list of mailboxes
2. imap_open : Opens an IMAP stream to mailbox

Examples of LDAP Functions:

1. ldap_connect : This will connect to the ldap server with
the given login credentials.
2. ldap_search : By using this command we can search in ldap
records.

how to retrieve from database..... this format (PRMRMDU402).
firstname= prabhu, lastname=kumar, city=madurai,
pincode=624402....

i want first name first two letters and last name last two
letters ... city first two letters ... pin code last three
letters....

$record = mysql_fetch_array(".........");
$fn = substr($record['firstname'], 0, 2);
$ln = substr($record['lastname'], -2);
$ct = substr($record['city'], 0, 2);
$pc = substr($record['pincode'], -2);

$final = strtoupper($fn.$ln.$ct.$pc);

echo $final;

What are the advantages and disadvantages of Cascading  Style Sheets?
Advantages and Disadvantages  Greater Control. Style sheets allow far greater control  over the appearance of a document. Many different elements  can be defined and customised, including margins, indents,  font size, line and letter spacing. In addition, elements  can be positioned absolutely on the page.  Separation of Style and Content. By ensuring that the style  and content of a document are kept separate, data is kept  more coherent. In this way, as technologies such as XML and  databases increase, there will be more scope for  integration of existing HTML documents.  Accessibility. Similarly, with the separation of style and  content, documents are made more accessible to those with  disabilities. When style sheets are used, software such as  screen-readers are less likely to be confused by spurious  code. For further information on accessibility issues,  please refer to the W3C's page on the Accessibility  Features of CSS.  Smaller Documents. Because all tags or properties need only  be defined once within a document, or even within a  separate document, filesize can be reduced considerably.  Easier Site Maintenance. As it is possible to link many  pages to one individual style sheet, any sitewide changes  can be made by simply changing the one file that the pages  link to, instead of all the individual files.  Browser Support. This is the one major drawback to style  sheets. They are only supported at all by IE 3 and above  and Netscape 4 and above, but even then, the way in which  the two browsers interpret them can vary considerably.  However, older browsers will still display your website,  simply ignoring the elements they do not understand.
Is there any function to find repeated value in an array?
#Following Code -  $array = array(1, "hello", 1, "world", "hello"); print_r(array_count_values($array));  ## #Outputs -  Array (     [1] => 2     [hello] => 2     [world] => 1 ) 
mysql_connect and mysql_pconnect()
mysql_connect which establishes a new connection "each time" and mysql_pconnect which uses persistant connections.

http://www.alledia.com/blog/general-cms-issues/joomla-and-drupal-%11-which-one-is-right-for-you?/