Why doesnt order by desc/asc work?

                         try {

                        $pdo = new PDO($this->dsn, $this->user, $this->password);

        } catch (PDOException $e) {

            echo 'Connection failed: ' . $e->getMessage();

        }

        $stm = $pdo->query("SELECT * FROM testt ORDER BY ASC"); // doesnt work
        $stm = $pdo->query("SELECT * FROM testt); // works
        $rows = $stm->fetchAll(PDO::FETCH_ASSOC);

        foreach($rows as $row) {
            echo '$row['text']';

        }

You have not specified the column to order by.

Sponsor our Newsletter | Privacy Policy | Terms of Service