PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Khaled Al-Shamaa   Arabic MySQL Query   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Arabic MySQL Query
Build SQL queries considering Arabic lexical rules
Author: By
Last change: Implement Mr. Saleh AlMatrafe <> update on ArQuery class by using "CASE WHEN" statement in ORDER BY section for more relevant ordering.
Date: 16 years ago
Size: 4,773 bytes


Class file image Download
@ini_set('zend.ze1_compatibility_mode', '1');

mysql_connect('localhost', 'root', '');

if (isset(
$_POST['keyword'])) {
    if (
$keyword != '') {
$keyword = @$_POST['keyword'];
$keyword = str_replace('\"', '"', $keyword);

$obj = new ArQuery();

$strCondition = $obj->getWhereCondition($keyword);
    } else {
$strCondition = '1';

$StrSQL =
"SELECT headline FROM aljazeera WHERE $strCondition";
$rs = mysql_query($StrSQL);


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">

<meta http-equiv="Content-Type" content="text/html;charset=windows-1256" />

<meta name="Subject" content="Arabic Query Class" />
<meta name="Description" content="Arabic Query Class" />
<meta name="Classification" content="PHP and Arabic Language" />
<meta name="Keywords" content="MySQL, SQL, Query, Stem, Search, PHP, Arabic, Language, Development, Implementation, Open Source, Free, GPL, Classes, Code" />
<meta name="Language" content="English, Arabic" />
<meta name="Author" content="Khaled Al-Shamaa" />
<meta name="Copyright" content="Khaled Al-Shamaa" />
<meta name="Designer" content="Khaled Al-Shamaa" />
<meta name="Publisher" content="Khaled Al-Shamaa" />
<meta name="Distribution" content="Global" />
<meta name="Robots" content="INDEX,FOLLOW" />
<meta name="City" content="Aleppo" />
<meta name="Country" content="Syria" />

<link rel="shortcut icon" href="../favicon.ico" />
<link rel="stylesheet" type="text/css" href="style.css" media="all" />
<title>Arabic Query Class</title>


<div style="width: 80%; position:absolute; left:10%; top:0%; z-index:1">
<br />
<div class="tabArea" align="center">
  <a class="tab" href="example.php">Example</a>
  <a class="tab" href="about.html">About</a>
  <a class="tab" href="">Homepage</a>

<div class="Paragraph" dir="rtl">

    <font face="Tahoma" size="2">
    <table border="0" width="100%" dir="ltr">
        <td align="center">
          <a href="" target=_blank><img src="images/Aljazeeralogo.gif" border="0"></a>
        <td align="center">
          <font face="Tahoma" size="2">Example database table contains 574 headline from
          <a href="" target=_blank></a>
          news channel website presented at 2003.</font>
    </table><hr />
    <form action="example.php" method="POST" name="search">
        إبحث عن (Search for): <input type="text" name="keyword"> <input type="submit" value="بحث (Go)" name="submit" /> (مثال: فلسطينيون)<br />
            <input type="radio" name="mode" value="0" checked /> أي من الكلمات (Any word)
            <input type="radio" name="mode" value="1" /> كل الكلمات (All words)

<?php if (isset($_POST['keyword'])) { ?>

    <hr />
    صيغة الإستعلام <span dir="ltr">(SQL Query Statement)</span>
    <br /><textarea dir="ltr" align="left" cols="80" rows="4"><?php echo $StrSQL; ?></textarea><hr />

    نتائج البحث عن (Search for) <b><?php echo $keyword; ?></b>:<br />
    <table cellpadding="5" cellspacing="2" align="center" width="80%">
            <td bgcolor="#004488" align="center"><font color="#ffffff" size="2"><b>الخبر كما ورد في موقع الجزيرة<br />Headline at</b></font></td>
= 0;
while (
$row = mysql_fetch_assoc($rs)) {
$headline = $row['headline'];
    if (
$i % 2 == 0) {
$bg = "#f0f0f0";
    } else {
$bg = "#ffffff";
"<tr bgcolor=\"$bg\"><td><font size=\"2\">$headline</font></td></tr>";

<?php } ?>


<table border="0" cellspacing="0" align="left">
    <td bgcolor="#448800">&nbsp;&nbsp;</td>
    <td bgcolor="#66aa00">&nbsp;&nbsp;</td>
    <td bgcolor="#77bb00">&nbsp;&nbsp;</td>
    <td bgcolor="#aadd00">&nbsp;&nbsp;</td>
    <td bgcolor="#eeff66">&nbsp;&nbsp;</td>

          <script src="" type="text/javascript">
          <script type="text/javascript">
          _uacct = "UA-1268287-1";