Código PHP:
$link = mysql_connect('localhost', 'root');
if (!$link) {
die('Not connected : ' . mysql_error());
}
$sql = "SELECT rta FROM kozzy WHERE cmd = '" .$mensaje . "' order BY RAND Limit 1";
$result = mysql_query($sql) or print(mysql_error());
$row = mysql_fetch_array($result) or print(mysql_error());
$this->send_data('PRIVMSG', $this->ex[2].' :'.$row['rta']);