DATABASE PROBLEM
Posted: Sat May 12, 2007 10:10 pm
* i really need help on how i can properly retreive a word existing from the database, by typing a sentence and analyzing if those words are existing.
* i also want to check spelling of the words.. the code below doesnt show any result from the database..i think i got the syntax wrong..or maybe the logic is wrong..please help me.. im just a newbie in using PHP. Thanks.
*And also if the word entered is in capital letters even though it already exists in the database it says that it doesnt. PLease tell me to upper function
* i also want to check spelling of the words.. the code below doesnt show any result from the database..i think i got the syntax wrong..or maybe the logic is wrong..please help me.. im just a newbie in using PHP. Thanks.
*And also if the word entered is in capital letters even though it already exists in the database it says that it doesnt. PLease tell me to upper function
Code: Select all
<?
include("ecsel_connectdb.php");
$myarray=explode(' ', $_POST['textarea']);
foreach($myarray as $a)
{
echo " word: $a";
echo "<br/>";
$sql="SELECT WORD FROM WORDS where WORD= '$a'";
$sql_result=mysql_query($sql,$connection) or die ("Couldnt execute query at WORDS");
$row= mysql_fetch_array($sql_result);
if($a==$row["WORD"])
{
echo "$a word exist";
echo "<br/>";
}
else
{
echo "sorry $a word dont exist!";
echo "<br/>";
}
}
$string= implode(' ',$myarray);
echo "string: $string";
echo "<br/>";
?>