I want to query from the db records for a single post (title, body, date)
For example I have my query..
$query = 'SELECT * FROM posts WHERE id=$post_id';
From that query how can I echo the title for instance without a while or foreach loop?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can just call mysql_fetch_assoc() (or any similar function) one. Like this:
This is the easiest and most readable way to do this with the MySQL functions.