Q:

Get the mysql data

I am trying to get a mysql data from the table, here -
try
    {
        $stmt = $user->prepare("SELECT status FROM users");
        $result=$stmt->fetch(PDO::FETCH_ASSOC);

        if($result['status'] != "Y")
        {
            $error[] = "Some error warning!";
        }
        else 
        {
            // Some php codes
        }
    }
catch(PDOException $e)
{
    echo $e->getMessage();
}

Here user is a class where prepare is db connection mysql prepare function. The error always prints - "Array!". I am new to php. Any help will be appreciated.
EDIT: I have managed to solve the problem.

A:

You forgot the call of PDOStatement::execute(). See php.net for some examples.
Have you already tried this?
try
{
    $stmt = $user->prepare("SELECT status FROM users");
    $stmt->execute();

    $result = $stmt->fetch(PDO::FETCH_ASSOC);

    if($result['status'] != "Y")
    {
        $error[] = "Some error warning!";
    }
    else 
    {
        // Some php codes
    }
}
catch(PDOException $e)
{
    echo $e->getMessage();
}

Regarding the Array! output: Did you post the whole code of your script? Were do you try to print the array $error?

