Hi this is Scorpionz

Reason of this thread:

I have created a small record sheet in which, I created 3 fields namely
('name, store_date, store_time') and handling this through PHP like i insert name in the field and press button it then saves (Present time as stated in machine and Present date).
I take date as type: date
and time in varchar in my database, I am using mysql as a DB.

and then showing a record on my browser that i add it with date and time

Now the question is that, If i want to see a record of those to whom
i added in last 24 hours, What should the query be??? As i mention in the query as well in comments field

Any response will be highly appreciated with great interest. Here is the code. my database table structure is this:

@@@@@@@@@@@@@@@@@@@@@@
CREATE TABLE `name_store` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(20) collate latin1_general_ci NOT NULL,
`store_date` date NOT NULL,
`store_time` varchar(20) collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;
@@@@@@@@@@@@@@@@@@@@@

and below is the code its not difficult to run it as i have already mention the condition, that is of Time and date issue.

<table width="308" border="1">
  <tr>
    <td width="99"><em>Name</em></td>
    <td colspan="2"><label>
      <input type="text" name="name" />
    </label></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2"><label>
      <input type="submit" name="insert_name" value="Insert" />
    </label></td>
  </tr>
  <tr>
    <td colspan="3">
		<?php 
			if(isset($_POST[""]))
			{
				$name			=	$_POST["name"]
				$storing_date	=	date("Y-m-d");
				$storing_time	=	date('h:i:s A');
				
				$sql_insert_name	=	"insert into name_store(name,store_date,store_time)values('$name','$storing_date','$storing_time')";
				mysql_query($sql_insert_name);
				
			}
		?>
	</td>
  </tr>
  <tr bgcolor="#999999">
    <td align="center"><strong>Name</strong></td>
    <td width="87"><strong>Time</strong></td>
    <td width="100"><strong>Date</strong></td>
  </tr>
  <?php
  	 $sql_get_data		=	"select * from name_store"; // What should i writer in where clause?
	 $result_get_data	=	mysql_query($sql_get_data);
	 while($rs_get_data	=	mysql_fetch_array($result_get_data))
	 {
	 	$name_get		=	$rs_get_data["name"];
		$date_get		=	rs_get_data["store_date"];
		$time_get		=	$rs_get_data["store_time"];
		
	 	
  ?>
  <tr bgcolor="#CCCCCC">
    <td align="center"><?php echo $name_get; ?></td>
    <td align="center"><?php echo $date_get; ?></td>
    <td align="center"><?php echo $time_get; ?></td>
  </tr>
  <?php
  }
  ?>
</table>

I hope i describeS it completely and in lite wordings
Waiting.....

Regards
Scorpionz

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.