The error is caused because your call to mysql_db_query() failed to return a result set identifier.
1) int mysql_db_query (string database, string query [, int link_identifier])
From the signature you can see that the first arguement is the database name. Is coupons the name of the database or just a table. In most cases, a script only needs to access one database. Therefor, I usually see ppl write their code like this:
2) AMD make computer chips, you want AND
$conn = @mysql_connect("localhost", "welcometovernon", "xxxxxx")
or die("Unable to connect");
or die( "Unable to connect");
$result = mysql_query("SELECT * FROM coupons WHERE username = '$username'
AND password = '$password'");
$num = mysql_num_rows($result);