you forget the quote-mark when you created the string.
Are you sure that sql works? If not, then check it in phpmyadmin.
If you have more than one result the technique how you get these results is different.
Here is an example how to check if it has no result, one result, and has more then one result.
<?php
$query = sprintf( "SELECT profiles.dob, profiles.mob FROM profiles
RIGHT JOIN (
profile_connector
RIGHT JOIN user
ON profile_connector.user_id = user.user_id
)
ON profiles.profile_id = profile_connector.profile_id
WHERE user_id= '%d'", $_SESSION['userId'] );
$result = mysql_query( $query, $GLOBALS['DB'] );
if ( !$result )
{
echo 'Could not run query: ' . $query . " , error:" . mysql_error();
}
$nums = mysql_num_rows( $result );
if ( $nums < 1 )
{
// if the results is 0
echo "No result";
} elseif ( $nums == 1 )
{
// if we have only one result
$row = mysql_fetch_assoc( $result );
echo $row["dob"];
echo $row["mob"];
}
else
{
// if we have more then one results
while ( $row = mysql_fetch_assoc( $result ) )
{
echo $row["dob"];
echo $row["mob"];
echo "<br />";
}
}
?>
Lets have a look at these commands in the manual:
mysql_error
mysql_fetch_assoc
mysql_num_rows
sprintf