Ok, I got what you mean about declaring variables, so I moved the connection info inside the function:
$o_conn=mysql_pconnect("localhost","testuser","testpassword");
mysql_select_db('testdb',$o_conn) or die("Couldn't open database");
now when the function is invoked I get the error...