0

I am new to PHP and MySQL.

This a project for a travel agency. there is form to insert details of a vehicle into database including current date and time. And details can be inserted multiple times for a vehicle in a day.

Now I am dynamically creating a table in HTML to display details of vehicle from database.

Now I have to add a new column to above html table to show the count of particular vehicle inserted for current day. How to query it in sql;

5
  • 2
    what exactly is your question? and add here what you have tried so far. Commented Mar 17, 2014 at 7:13
  • Please be clear in your Question. stackoverflow.com/questions/how-to-ask Commented Mar 17, 2014 at 7:14
  • tech-recipes.com/rx/378/add-a-column-to-an-existing-mysql-table this might be what you're looking for. Try google next time :) Commented Mar 17, 2014 at 7:22
  • what is that table you are talking about? HTML table or DB table? Commented Mar 17, 2014 at 8:09
  • I am sorry for incomplete question. I have edited the question now Commented Aug 13, 2014 at 6:25

1 Answer 1

1

You could try something like this in your HTML:

<tr>
  <td>Count</td>
  <td><?php echo $count; ?></td>
</tr>

In MySql,

SELECT COUNT(vehicle_name) FROM myTable WHERE DATE(myDate) = DATE(NOW());
Sign up to request clarification or add additional context in comments.

3 Comments

Please consider adding more detail to your answer. Why does this work, what are some potential drawbacks of this approach, etc.
I am sorry for incomplete question. I have edited the question now
@Vivek Its kind of correct vivek. Your answer was helpful. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.