I have PHP code like this
require_once( "includes" . DIRECTORY_SEPARATOR . "constants.php");
$userID = validKey( $key );
$query = "select a.username, b.streamID
from user a, streams b
where a.id = b.userID;)";
$connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
if (!$connection) { die("Database connection failed: " . mysql_error()); }
$db_select = mysql_select_db(DB_NAME,$connection);
if (!$db_select) {die( "Database selection failed: " . mysql_error()); }
$generated_table = mysql_fetch_array(mysql_query($query, $connection)); // line (*)
print_r($generated_table);
But PHP gives me error/worning and does not print anything out
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given on line (*)
1) Why It does not printed me anything out
2) Where am I wrong?