Buenos días actualmente poseo un error en mi pagina y no encuentro el motivo, quiero lograr que al crear un nuevo post este se encuentre de primer lugar que los anteriores por ser el mas nuevo, utilice:
$sql = "SELECT * FROM $table ORDER BY id DESC";$sql = "SELECT * FROM $table ORDER BY id DESC";
pero me da el siguiente error
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE title=? LIMIT 1' at line 1 in C:\xampp\htdocs\app\database\db.php:17 Stack trace: #0 C:\xampp\htdocs\app\database\db.php(17): mysqli->prepare('SELECT * FROM p...') #1 C:\xampp\htdocs\app\database\db.php(78): executeQuery('SELECT * FROM p...', Array) #2 C:\xampp\htdocs\app\helpers\validatePost.php(12): selectOne('posts', Array) #3 C:\xampp\htdocs\app\controllers\capitulos.php(18): validatePost(Array) #4 C:\xampp\htdocs\admin\capitulos\create.php(1): include('C:\xampp\htdocs...') #5 {main} thrown in C:\xampp\htdocs\app\database\db.php on line 17
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE title=? LIMIT 1' at line 1 in C:\xampp\htdocs\app\database\db.php:17 Stack trace: #0 C:\xampp\htdocs\app\database\db.php(17): mysqli->prepare('SELECT * FROM p...') #1 C:\xampp\htdocs\app\database\db.php(78): executeQuery('SELECT * FROM p...', Array) #2 C:\xampp\htdocs\app\helpers\validatePost.php(12): selectOne('posts', Array) #3 C:\xampp\htdocs\app\controllers\capitulos.php(18): validatePost(Array) #4 C:\xampp\htdocs\admin\capitulos\create.php(1): include('C:\xampp\htdocs...') #5 {main} thrown in C:\xampp\htdocs\app\database\db.php on line 17