'; $retHTML .= $word[$i]; $retHTML .= ''; } return $retHTML; }//end printTiles function /****************************************************************** * function repaintBoard() * * @author - Garrison Locke * * The repaintBoard function is called every two seconds from the * javascript to keep the board up-to-date if people are making changes. * It just returns a string of top_value:left_value separated by the * pipe character. * ******************************************************************/ function repaintBoard(){ global $top_value, $left_value, $numWords; $retVal = ""; for($i=0; $i<$numWords; $i++){ $retVal .= $top_value[$i] . ":" . $left_value[$i]; if($i < $numWords-1){ $retVal .= "|"; } } return $retVal; }//end repaintBoard function /****************************************************************** * function saveTileLocation($obj, $x, $y) * * @author - Garrison Locke * * The saveTileLocation function does just that. It updates the * top and left values in the database for the given tile. * * $obj - The id of the object that was dragged (the tile). * $x - The new x coordinate of the tile. * $y - The new y coordinate of the tile. * ******************************************************************/ function saveTileLocation($obj, $x, $y){ global $numWords, $word, $top_value, $left_value, $host, $username, $password, $dbname, $connection; $index = substr(strrchr($obj, "_"), 1); $query = "Update magnetic_poetry set top_value=$y, left_value=$x WHERE id=$index"; $result = mysql_db_query($dbname, $query); if (!$result) { die("Error: " . mysql_error()); } return $query; }//end saveTileLocation function ?> \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\