<?php
	include 'connection.php';
	$data = mysql_query( "SELECT Date,color_code, COUNT(color_code) FROM paintshop WHERE Date BETWEEN '$startDate' AND '$endDate'") or die('error');
	while($rw = mysql_fetch_array($data)){ 
	?>
    <td width="59" height="25" class="style5Copy"><?php echo $rw['Date']; }?></td>

i want display the dates between i post from the form..
eg: start date = 1-12-2011 until end date 7-12-2011
(meaning 1-12-2011,2-12-2011,3-12-2011,4-12-2011,5-12-2011,6-12-2011,7-12-2011):-/

Your query looks fine and should display dates (if they're selected as inputs in your form). Unless, you have fixed dates. For example, startDate begins from 1-12-2011 and endDate is only specified by your clients.

So What's up with your piece of code? Is it doing what it is expected to do or you have problems with it?

<?php

    include 'connection.php';
    $data = mysql_query( "SELECT Date,color_code, COUNT(color_code) FROM paintshop WHERE Date BETWEEN '$startDate' AND '$endDate'") or die('error');
    $result = mysql_query($data) or die(mysql_error());
 
echo "<table>
<tr>
	<td>row1</td>
	<td>row2</td>
	<td>row3</td>
	<td>row4</td>
</tr>"; 
    
    while($row = mysql_fetch_array($result, MYSQL_BOTH)){
 echo "<tr>
	<td>".$row['somerow']."</td>
	<td>".$row['anotherrow']."</td>
	<td>".$row['otherrow']."</td>
	<td>".$row['month']."</td>
</tr>";
}
echo "</table>"
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.