I was developing a database driven website. I know the basics about php and mysql. Now there are a couple of things that i would like to ask. Like,
I have a table created in my sql named 'news' that contains following fields:
id (int)
newstitle (varchar)
newscontent (varchar)
dateadded (date)
NOTE date added only contains date.
I have created a query with php pdo which looks something like this
$query = $pdo->prepare("SELECT * FROM news ORDER BY dateadded DESC LIMIT 5");
The above query is giving me error which is something about wrong MySql syntax. What would be correct query format? What i want to do is fetch only 5 records from 'news' table in descending order sorted by Date & Time both and as date is already stored in 'dateadded' field e.g. "2019-01-03" i also want to store time along with it and query my results accordingly with date and time in descending order? And lastly i want to display the records using PHP PDO while loop.
Help will be highly appreciated.
P.S.(Sorry for bad english and if you see any error or formatting mistakes feel free to edit)
FROM database_name.table_name- Quasimodo's clone