I have a problem in translation script
This is the code
///////////////////////////////////////////////////////////////////////
<?
$word = "translate".$_GET[word];
if(!$word)$word="translate";
$mor1='<a href="trans.php?mor=1">advanced search</a> ';
if($_GET[mor]){
$mor2 = '
exact<input type="radio" name="w" value="w1" checked>
start with<input type="radio" name="w" value="w2">
end with<input type="radio" name="w" value="w3">
<br>';
$mor1='';
}
?>
<html dir="rtl">
<head>
<title><?print $word;?></title>
</head>
<body>
<form action="trans.php" method="GET">
<center>
<div style="border:1px solid;background-color:#EEEEEE;width:50%">
<?print $mor1?>
<input type="text" name="word"><br>
<? print $mor2;?>
<input type="submit" value="translate">
</div>
</center>
</form>
<hr>
<?
$link = mysql_connect("localhost","ba7rainc_trans","password");
$db = mysql_select_db("ba7rainc_trans");
if($_GET[word]){
$word = addslashes($_GET[word]);
if(preg_match("/[a-zA-Z]/",$word)){
$lang = "en";
print "<div style=\"background-color:#efefef\"><hr>";
}else{
$lang = "ar";
$binary = "binary ";
print "<div style=\"background-color:#efefef\"><hr>";
}
$sql = "SELECT * FROM `trans` WHERE $lang LIKE $binary'%$word%' LIMIT 30";
switch($_GET[w]){
case "w1":
$sql = "SELECT * FROM `trans` WHERE $lang = $binary'$word' LIMIT 30";
break;
case "w2":
$sql = "SELECT * FROM `trans` WHERE $lang LIKE $binary'$word%' LIMIT 30";
break;
case "w3":
$sql = "SELECT * FROM `trans` WHERE $lang LIKE $binary'%$word' LIMIT 30";
break;
}
$query = mysql_query($sql);
/*line 58*/ while($found = mysql_fetch_array($query))
($lang=="en")? print $found[en]." : <b>".$found[ar]."</b><hr>\n" : print $found[ar]." : <b>".$found[en]."</b><hr>\n";
}
?>
</div>
</body>
</html>
////////////////////////////////////////////////////////////////
when i run it i got an error message
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/******/public_html/trans/trans.php on line 58
the line 58 is
while($found = mysql_fetch_array($query))
so could u help me???