$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) {