I have this script:
$db = mysql_connect($hostname, $db_user, $db_password);
mysql_select_db($database,$db) or die( "Unable to select database");
mysql_query("set names 'utf8'");
$wordy = "pate";
$query = mysql_query("SELECT DISTINCT * FROM $db_table WHERE word LIKE '[pate]' ORDER BY word DESC");
$num = mysql_numrows($query); $i=0;
while ($i < $num) {
$word = mysql_result($query,$i,"word");
echo $word." ";
$i++;
}
$db_table contains English words. I want to echo out all possible anagrams; in this case it should echo tape pate peat. What query could I use to do this?
http://msdn.microsoft.com/en-us/library/ms179859.aspx <- here is a description
I think first you must re arrange all the letters in the word to form an array
then do a sql query like :
got another idea :
you can do something like …
Froe the comments I could suggest you use
length(word) = strlen($wordy)