Where I get wrong?

Posted by Ole Jak on Stack Overflow See other posts from Stack Overflow or by Ole Jak
Published on 2010-05-07T21:55:09Z Indexed on 2010/05/07 21:58 UTC
Read the original article Hit count: 137

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about php

Related posts about beginner