Retriving value from MySQL - real time
===

I tried using this PHP script to retrive the value from a mySQL server, but it does not work.

    <?php 
    
    mysql_connect("url","username","password"); 
    mysql_select_db('databasename'); 
    $res = mysql_query('SELECT field FROM tbl'); 
    $row = mysql_fetch_array($res); 
    echo $row[0]; 
    
    ?>

1. Is there something I have missed in the process? (this code)
2. How would I retrive real time data?