Replace dates in an array of date with values in a mysql query
I have used the below link to create an array of date.
http://boonedocks.net/mike/archives/137-Creating-a-Date-Range-Array-with-PHP.html
However, I wanted to replace dates in that array by comparing the date(in
the array) and the date(in query result).
If they are equal then I will replace that date in the array with the
result in the mysql query.
array:
array(
9/1/2013,
9/2/2013,
9/3/2013,
9/4/2013,
9/5/2013
)
query result:
| date | values |
| 9/2/2013 | 5 |
| 9/3/2013 | 6 |
| 9/5/2013 | 7 |
the result must be like this:
PHP date ----> 9/1/2013 0
Database ----> 9/2/2013 5
Database ----> 9/3/2013 6
PHP date ----> 9/4/2013 0
Database ----> 9/5/2013 7
How do i do that in PHP? I've been experimenting with while loops inside
foreach, but does not work.
No comments:
Post a Comment