par Jefekoi » 10 juin 2019, 01:38
par Saian » 09 juin 2019, 23:33
if ($conn) $conn->close();
par Saian » 09 juin 2019, 23:28
par Jefekoi » 09 juin 2019, 23:24
par Jefekoi » 09 juin 2019, 23:07
par Saian » 09 juin 2019, 22:23
par Jefekoi » 09 juin 2019, 22:22
par Saian » 09 juin 2019, 22:18
par Jefekoi » 09 juin 2019, 22:15
par Saian » 09 juin 2019, 21:31
$query = 'SELECT * FROM dictionnaire WHERE sorted_letters IN (:combinations) ORDER BY scrabble_name ASC';
par Jefekoi » 09 juin 2019, 21:30
par Saian » 09 juin 2019, 21:21
$conn = new mysqli($servername, $username, $password, $dbname); $searchedWord = isset($_GET['word']) ? $_GET['word'] : 'stalagmometres'; $query = 'SELECT * FROM dictionnaire WHERE sorted_letters IN (:combinations)'; for ($length = strlen($searchedWord) - 1; $length > 1; $length--) { echo "<br/>Anagrams with <b>$length</b> letters<br/>"; $combinations = array(); $combination = new Combination($searchedWord, $length); while ($letters = $combination->next()) { $combinations[] = $letters; } $combinationQuery = str_replace(':combinations', "'".implode("', '", $combinations)."'", $query); echo 'Query:<br/>'.$combinationQuery.'<br/>'; $words = $conn->query($combinationQuery); if (!$words) echo 'Error: '.$conn->error.'<br/>with query:<br/>'.$combinationQuery; else { echo 'Words:<br/>'; while ($word = $words->fetch_object()) { echo $word->scrabble_name.'<br/>'; } } }
par Saian » 09 juin 2019, 21:10
$conn = new mysqli($servername, $username, $password, $dbname); $word = isset($_GET['word']) ? $_GET['word'] : 'stalagmometres'; $query = 'SELECT * FROM dictionnaire WHERE sorted_letters IN (:combinations)'; for ($length = strlen($word) - 1; $length > 1; $length--) { echo "<br/>Anagrams with <b>$length</b> letters<br/>"; $combinations = array(); $combination = new Combination($word, $length); while ($letters = $combination->next()) { $combinations[] = $letters; } $combinationQuery = str_replace(':combinations', "'".implode("', '", $combinations)."'", $query); echo 'Query:<br/>'.$combinationQuery.'<br/>'; $words = $conn->query($combinationQuery); if (!$words) echo 'Error: '.$conn->error.'<br/>with query:<br/>'.$combinationQuery; else { echo 'Words:<br/>'; while ($word = $words->fetch_object()) { echo $word->scrabble_name.'<br/>'; } } }
par Jefekoi » 09 juin 2019, 21:08
Code : Tout sélectionner
$word = 'selectionner'; echo "Nom= ".$word ; echo "<hr/>"; $conn = new mysqli($servername, $username, $password, $dbname); $query = 'SELECT * FROM dictionnaire WHERE sorted_letters IN (:combinations)'; for ($length = strlen($word) - 1; $length > 1; $length--) { echo "<br/>Anagrams with <b>$length</b> letters<br/>"; $combinations = array(); $combination = new Combination($word, $length); while ($letters = $combination->next()) { $combinations[] = $letters; } $combinationQuery = str_replace(':combinations', "'".implode("', '", $combinations)."'", $query); $words = $conn->query($combinationQuery); while ($word = $words->fetch_object()) { echo":".$word->scrabble_name.'<br/>'; } } echo "<hr/>"; $word = 'selectionner'; $conn = new mysqli($servername, $username, $password, $dbname); $query = 'SELECT * FROM dictionnaire WHERE sorted_letters IN (:combinations)'; for ($length = strlen($word) - 1; $length > 1; $length--) { // echo "<br/>Query for combinations with <b>$length</b> letters<br/>"; echo "<br/><br/>"; $combinations = array(); $combination = new Combination($word, $length); while ($letters = $combination->next()) { $combinations[] = $letters; echo $letters.", "; } //$combinationQuery = str_replace(':combinations', "'".implode("', '", $combinations)."'", $query); // echo $combinationQuery.'<br/><br/>'; }
par Saian » 09 juin 2019, 20:46
$conn = new mysqli($servername, $username, $password, $dbname); $word = 'stalagmometres'; $query = 'SELECT * FROM dictionnaire WHERE sorted_letters IN (:combinations)'; for ($length = strlen($word) - 1; $length > 1; $length--) { echo "<br/>Anagrams with <b>$length</b> letters<br/>"; $combinations = array(); $combination = new Combination($word, $length); while ($letters = $combination->next()) { $combinations[] = $letters; } $combinationQuery = str_replace(':combinations', "'".implode("', '", $combinations)."'", $query); $words = $conn->query($combinationQuery); while ($word = $words->fetch_object()) { echo $word->scrabble_name.'<br/>'; } }