Example Code:
<?php
require '../../Arabic.php';
$Arabic = new I18N_Arabic('Query');
echo $Arabic->allForms('فلسطينيون');
$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_ERRMODE, PDO::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 % 2 == 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.0055701732635498 seconds
Amount of memory allocated to this script is 406960 bytes
Names of included or required files:
- /home/paneocloud/public_html/demo.paneo.tech/tjnalms/vendor/chehivskiy/i18n-arabic/I18N/Arabic/Examples/Query.php
Related Class Documentation