Example Output:

Example database table contains 574 headline from Aljazeera.net news channel website presented at 2003.

إبحث عن (Search for): (مثال: فلسطينيون)
أي من الكلمات (Any word) كل الكلمات (All words)

  Related Class Documentation

Example Code:

<?php
    
require('../I18N/Arabic.php');
    
$Arabic = new I18N_Arabic('Query');
    echo 
$Arabic->allForms($_GET['keyword']);
    
    
$dbuser 'root';
    
$dbpwd '';
    
$dbname 'test';
    
    try {
        
$dbh = new PDO('mysql:host=localhost;dbname='.$dbname$dbuser$dbpwd);

        
// Set the error reporting attribute
        
$dbh->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION);

        
$dbh->exec("SET NAMES 'utf8'");
    
        if (
$_GET['keyword'] != '') {
            
$keyword = @$_GET['keyword'];
            
$keyword str_replace('\"''"'$keyword);
    
            
$Arabic->setStrFields('headline');
            
$Arabic->setMode($_GET['mode']);
    
            
$strCondition $Arabic->getWhereCondition($keyword);
            
$strOrderBy   $Arabic->getOrderBy($keyword);
        } else {
            
$strCondition '1';
        }
    
        
$StrSQL "SELECT `headline` FROM `aljazeera` WHERE $strCondition ORDER BY $strOrderBy";

        
$i 0;
        foreach (
$dbh->query($StrSQL) as $row) {
            
$headline $row['headline'];
            
$i++;
            if (
$i == 0) {
                
$bg "#f0f0f0";
            } else {
                
$bg "#ffffff";
            }
            echo 
"<tr bgcolor=\"$bg\"><td><font size=\"2\">$headline</font></td></tr>";
        }

        
// Close the databse connection
        
$dbh null;

    } catch (
PDOException $e) {
        echo 
$e->getMessage();
    }
?>

Total execution time is 0.00018405914306641 seconds
Amount of memory allocated to this script is 377352 bytes