IT solutions by AbeleDesign Montreal, QC
Case studies in SEO and Internet marketing
Knowledge base in PHP, MySQL, Ajax
Useful PHP scripts and tips
PHP is a modern server side language for web development and reliable network programming, object-oriented after version PHP5. The abbreviation PHP stands for Hypertext Preprocessor and comes from the main characteristics of PHP
Platforms supported by PHP
PHP has installation packages for all major platforms like: AS400, MacOS, Novell Netware, OS2, Solaris, CentOS, Linux and Windows. Please refer to PHP.net website for more information.
Example of PHP code to connect to a MySQL database
The following code can be used in a PHP files to connect to MySQL databases to insert, update and retrieve data from the tables. Ususally can be implemented in code by using the include("script.inc"); command
<?php
$dbhost = 'localhost';
$dbuser = 'username';
$dbpass = 'password';
$mysql_access = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
?>
PHP function to verify the SoundEx of sentences
SoundEx is an algorythm for verifying the similarities of the words based on their sound pronounciation
function checkSoundexWords($word1, $word2) {
$samewords = true;
$word1_array = explode(" ", $word1);
$word2_array = explode(" ", $word2);
if (sizeof($word1_array) == sizeof($word2_array)) {
for($s=0; $s<sizeof($word1_array); $s++) {
if ( soundex($word1_array[$s]) == soundex($word2_array[$s]) && $samewords ) {
$samewords = true;
} else {
$samewords = false;
}
}
} else {
$duplicate_word_od_words = 0;
for($s=0; $s<sizeof($word1_array); $s++) {
for($p=0; $p<sizeof($word2_array); $p++) {
if ( soundex($word1_array[$s]) == soundex($word2_array[$p]) ) {
$duplicate_word_od_words +=1;
}
}
}
//echo $duplicate_word_od_words / ($s * $p) . "%";
if ( $duplicate_word_od_words / ($s * $p) < 0.167) { $samewords = false; }
}
return $samewords;
}
