You have to send the mysql resource as an argument to the function so that the variable can be used inside of the function.
When you open the connection with mysql_connect assign the connection to a variable. Although it will be assumed in all other parts of your code, you will need this when calling your function.
function getMessages($resource) {
$rs = mysql_query( "SELECT * FROM MINICHAT ORDER BY NB", $resource );
$ret = Array();
$count = 0;
while ( $msg = mysql_fetch_assoc($rs))
$ret[$count++] = date('h:m', $msg['ITSTIME'] )." ".$msg['LOGIN']." >".$msg['MESSAGE'];
return $ret;
}
Im not 100% on that so you could also try...
function getMessages() {
$rs = mysql_query( "SELECT * FROM MINICHAT ORDER BY NB");
$ret = Array();
$count = 0;
while ( $msg = mysql_fetch_assoc($rs))
$ret[$count++] = date('h:m', $msg['ITSTIME'] )." ".$msg['LOGIN']." >".$msg['MESSAGE'];
return $ret;
}
And that could just work.
Hope ive helped.