<?php
     

					$current_date = strtotime('now');
					$due_end_date = 60*60*24*7; // Number of seconds for 7 days
					 
		$sql = "SELECT * FROM sre_log WHERE current_date >== '$due_end_date-$current_date' ORDER by vtype";
						$due_end_date = mysql_query($sql);
						//echo "$current_date";
						
					 while($a < $sre_log_num) 
											{
												$id = mysql_result($sre_log_result,$a,"id");
												$vtype = mysql_result($sre_log_result,$a,"vtype");
												$due_end_date = mysql_result($sre_log_result,$a,"due_end_date");
												$current_date = mysql_result($sre_log_result,$a,"current_date");
												}
												echo "$due_end_date";
												echo "$current_date";
												echo "$vtype";
												$a++;	
										    	
											
					// If the previous article has a different day than this article then place this header
					if ($current_date != $due_end_date)
					{
					echo "<h3 class=\"update\">";
					echo "<em>There are no reminders for vehicle $vreg</em>";
					echo "<em style=\"font-size:12px; float:right;\">Next Service Dued $vreg[$due_end_date]</em>";
					echo "</h3>";
					}
					
					 elseif ($current_date == $due_end_date)
					{
					 
					// Put the details of each vehicle here.
					echo "<div>'$last_startdate'[Last_Service_Done]</div>";
					echo "<div>'$vreg'[Next_Service_Due: $due_end_date]</div>";
					
					}
					  ?>

You forgot to add what part is not working well. It appears this is not the complete code, as there is no mysql_connect in this snippet.

<?php
     

	$current_date = strtotime('now');
	$due_end_date = 60*60*24*7; // Number of seconds for 7 days
					 
$sql = "SELECT * FROM sre_log WHERE current_date >== '$due_end_date-$current_date' ORDER by vtype";
	$due_end_date = mysql_query($sql);
	//echo "$current_date";
						
	while($a < $sre_log_num) 
											{
												$id = mysql_result($sre_log_result,$a,"id");
												$vtype = mysql_result($sre_log_result,$a,"vtype");
												$due_end_date = mysql_result($sre_log_result,$a,"due_end_date");
												$current_date = mysql_result($sre_log_result,$a,"current_date");
												}
												echo "$due_end_date";
												echo "$current_date";
												echo "$vtype";
												$a++;	
										    	
											
	// If the previous article has a different day than this article then place this header
	if ($current_date != $due_end_date)
	
       {
		echo "<h3 class=\"update\">";
		echo "<em>There are no reminders for vehicle $vreg</em>";
		echo "<em style=\"font-size:12px; float:right;\">Next Service Dued $vreg[$due_end_date]</em>";
		echo "</h3>";
	}
					
		elseif ($current_date == $due_end_date)
		
             {
					 
		// Put the details of each vehicle here.
		echo "<div>'$last_startdate'[Last_Service_Done]</div>";
		echo "<div>'$vreg'[Next_Service_Due: $due_end_date]</div>";
					
		}
		?>
i need to create a reminder for for my users,if i input a date for a reminder,it echos back this,["1324034507",instead of a normal date and this
"There are no reminders for vehicle"] even when i change the date to so as to get a reminder.
This is a picture of my mysql db.

You can format your date with the date() function. What is the column type for your date columns ?

Thank you for your help,i think i have clean up some part of the code.I am very regretful. I still have some errors showing up.This is the error message

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\xampp\htdocs\msl\admin\userindex\serxbh738hss.php on line 156

And this is the code below:

<?php
                                        
                       $current_date = strtotime('now');
		       $due_end_date = 60 * 60 * 24 * 7;
		       $last_startdate = last_startdate;
		       $vtype = vtype;
			$vreg = vreg;    
			$dept = dept;
			$name_mech = name_mech;
			$com_name = com_name;
									
									
										
$sql_query = "SELECT * FROM sre_log WHERE current_date >= '$due_end_date-$current_date' ORDER by vreg";

		$result = mysql_query($sql_query);
		//$num_results = mysql_num_rows($result);
		while ($row = mysql_fetch_array($result))

		// while ($sre_log = mysql_fetch_array($sre_log))
		
                    {
											
			$id = $row['id'];
			$vtype = $row['vtype'];
			$vreg = $row['vreg'];
			$current_date = $row['current_date'];
			$dept = $row['dept'];
			$name_mech = $row['name_mech'];
			$com_name = $row['com_name'];
									
			}
										
			if ($current_date != $due_end_date) 
										
			{
				echo "<h3 class=\"update\">";
				echo "<em>There are no reminders for vehicle # $vreg</em>";
				echo "<em style=\"font-size:12px; float:right;\">Next Service Dued $vreg[$due_end_date]</em>";
				echo "</h3>";
					}
										
				elseif ($due_end_date == $current_date) 
										
				{
					echo "<div>'$last_startdate'[Last_Service_Done]</div>";
					echo "<div>'$vreg'[Next_Service_Due: $due_end_date]</div>";
				}
										
					else
										
					{
						echo "Pls. enter data for vehicle";
					}
                                            ?>

Your query is wrong. I suggest you move the subtract of your two variables (line 14) into a new variable on line 13, and use that new variable in your query.

Can you pls. give an example,Thanks.

$endminuscurrent = $due_end_date-$current_date;
$sql_query = "SELECT * FROM sre_log WHERE current_date = '$endminuscurrent' ORDER by vreg";
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.