Tohle vypadá, že používáš SQL, aniž bys otevřel spojení na databázi
The gotcha for me was remembering to use the mysql_select_db() function. I use mysql_connect() and then mysql_select_db() before I do the mysql_query. Like this...
$sql_conn = mysql_connect($hostName, $dbuser, $dbpass);
mysql_select_db($databaseName, $sql_conn);
$sql = "select * from tablename;";
$rs = mysql_query($sql, $sql_conn);
That did the trick for me.