I have a small problem I have a functional code which generates a random word
$codigo = mysql_query("SELECT * FROM palabras WHERE categoria='b'");
mt_srand(time());
$max = mysql_num_rows($codigo);
$rand = mt_rand(1,$max);
$obtener = mysql_query("SELECT * FROM palabras WHERE sub_categoria='$rand' AND categoria='b'");
while($ban = mysql_fetch_array($obtener)) { echo $ban['palabra']; }
but now I need to delete the field sub_categoria for other needs and try the following code
$codigo = mysql_query("SELECT * FROM palabras WHERE categoria='b'");
mt_srand(time());
$max = mysql_num_rows($codigo);
$rand = mt_rand(1, $max);
$ban = mysql_fetch_array($codigo)
echo $ban['palabra'][$rand];
but it turns out that it does not work for me, it throws me some letters that are not in the database, if they help me it would be very helpful