This is an extremely odd error.
The mysql_* functions are part of a now deprecated extension to PHP. But its possible you are running on a platform which still provides support for the extension and does not provide support for its replacement - the mysqli extension (such as Redhat/Centos/Scientific Linux 6).
You should have told us what the undelying operating system and PHP version is.
As expected, the usual trolls have said you should be using PDO. I have yet to see any credible evidence of a security issue in the mysql or the mysqli extension. Certainly PDO goes further in preventing you from doing really stupid things - but it also closes the door on other useful constructs in SQL (like a variable length IN(...) list or keyword search). OTOH if you sub-contract your programming to someone who is actively trying to inject backdoors into your site, you might want to read this - but they'll have little problem finding other ways to subvert your site.
Changing from the deprecated mysql extension to the procedural mysqli extension can be done with a shim or a scripted search and replace of your code. Changing to PDO will require a manual rewrite of all database interaction.
So the cause of the error is that the code you have written does not match the extensions available to your PHP install. To find the extensions which are available, look at the output of phpinfo();. How you install and enable an extension if you need it is dependant on your platform and whether you have the ability to configure it. You may already have the mysqli extension.
But even if you had the mysql extension available, this code will not work. You can't do anything to a database until you establish a connection - and this is a seperate function call for the mysql extension (and in PDO, and in procedural mysqli).