Ehrm....no offence, but first of all I would suggest you do some reading!. This shouldn't be a problem, especially for someone who 'knows' php.
your $result gives back a resource id because it is in fact a resource id, read the php documentation on how to use it. Someone who 'knows' php should...