//the database info file. customize the data in here for your database require_once("dbinfo.php"); //create a mysql connection $connection = mysql_connect($host, $username, $password) or die ('Cannot connect to the database because: ' . mysql_error()); $query = "Select * from magnetic_poetry"; //get all the words and positions from the database $result = mysql_db_query($dbname, $query); //the info from the database //arrays for the data from the database $id = array(); $word = array(); $top_value = array(); $left_value = array(); //enter the data from the database into the arrays for($x = 0; $row = mysql_fetch_array($result); $x++){ $id[$x] = $row["id"]; $word[$x] = $row["word"]; $top_value[$x] = $row["top_value"]; $left_value[$x] = $row["left_value"]; } $numWords = count($id); //the number of words there are in the database require_once("cpaint.inc.php"); //the AJAX library file. /****************************************************************** * function printTiles() * * @author - Garrison Locke * * The printTiles function goes through the data in the database * to create all the tiles. Each tile is in a div. That's basically * all this does. Pretty simple. * ******************************************************************/ function printTiles(){ global $id, $word, $top_value, $left_value, $numWords; $retHTML = ""; for($i=0; $i<$numWords; $i++){ $tileWidth = 7 * strlen($word[$i]); $tileHeight = 15; $retHTML .= '
MIS PALABRAS Estas son mis palabras, pero te las presto |
Estas son las palabras estadísticamente más frecuentes en mis poemas, espero puedan crear algunos nuevos poemas y compartirlos características: 1. el código es multijugador asi que si ven que algunas palabras se mueven solas es porque hay otra persona jugando con ustedes en ese momento 2. el código se recarga cada 4 seg 3. el código permite dejar en memoria las posiciones de las palabras, es decir que si lo dejas en cierta configuración mañana lo encontrarás igual, al menos claro, que alguien lo haya cambiado |
|