too long

I always use two variables to show the content of a column from a table. My table is "a_table" and has just one column called "name" (varchar). I'm doing it well?

<?php

//Just junk 
$connect =  mysql_connect('localhost', 'root');
if (!$enlace) {
    die('DAMN: ' . mysql_error());
}
echo 'GREAT';

$connect =  mysql_select_db('my_db', $connect);
if (!$enlace) {
    die('DAMN: ' . mysql_error());
}
echo 'GREAT X2';

//Important 

$name = mysql_query('SELECT `a_column` FROM `a_table`.`my_db` LIMIT 0, 30');
if (!$name) {
    die('DAMN' . mysql_error());
}
echo 'GREAT';

// Every mysql_query gives me a RESOURCE, so I've used to apply mysql_fetch_array

$the_variable_that_put_the_name_on_screen = mysql_fetch_array($name); 

echo  $the_variable_that_put_the_name_on_screen['name'];

function closeConn(){
    mysql_close();
}

?> 

The way you have written above is ok.

Although FYI mysql functions are deprecated as of PHP 5.5.0. If you are just learning it would be a good time to learn another database extensive like mysqli or PDO.

Ref: http://nz1.php.net/mysql_fetch_array