Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Date Dropdown From Mysql Date Entries


For the PHP gurus out there, here is what I want to do: create a dropdown list of available dates from a mysql database date entries. But the dropdown/s should have 3 separate fields in month, day and year which in effect shows only those months, days and years that have corresponding entries from the database.

Planning to use this in the archive section of an online news publication so people can select issues to view via dropdown list that have corresponding entries only.




View Complete Forum Thread with Replies

Related Forum Messages:
Dropdown Date Selector That Automatically Selects Todays Date
Does anyone have a PHP generated dropdown date selector that automatically selects todays date on page load that i can pinch?

View Replies !
Populating Dropdown With Mysql Entries
I would like to create a combobox in Flash which is populated with mysql data and programmed with php. For example: There are 3 entries in database .ie. apple, bannana, peach. Now these I want in combobox in Flash MX/flash5.

View Replies !
Date Is Not Being Pulled From MYSQL Database, Instead Current Date Is Displayed!
I am having trouble pulling a date from a database using PHP at the <a
href="http://www.mytuneslive.com/ameshkin69/"> following page.</a>

Here is the code. As you can see, it is just making the date the
current time. The values in the database are UNIX timestamp, and the
DATE() function is used to convert from UNIX to readable date. Can

<td width="55%" align="left" valign="top"><?php
$row_comment['timestamp'] = date("n d Y g:i A");.....

View Replies !
Store Date In A Date Field In My MYSQL Data Table
I have a form with a feild that when clicked on pops up a calendar which I can select a date I wnat to insert into the field. The date inserted displays "03 Apr, 2007". I want to store that date in a date field in my MYSQL data table, a field named "f_date" set to date type.

When I save the record the data field "f_date" displays "0000-00-00" which I take it the date input is not getting inserted to the table. My insert field code is PHP Code:

<input name="f_date"  type="text" class="bodytext" id="f_date" onclick='scwShow(this,this);' value="" size="15" />

View Replies !
Count Entries After Date
I've been using a script to count votes for pictures. Every time somene votes it records their ip and date they voted. It adds a new line to the table for every vote. (picNum is the picture they are voting for)PHP Code:

$query = "INSERT INTO kicks_voting (picture, ip, date) VALUES ('" . $_POST['picNum'] . "','" . $_SERVER['REMOTE_ADDR'] . "', '" . date('m.d.y') ."')";

Then when I want to see the total votes for a picture I use this script PHP Code:

$query = 'SELECT ip FROM kicks_voting WHERE picture ="' . $picNum . '"'   
$result = mysql_query($query);
mysql_num_rows($result);
echo mysql_num_rows($result);

What I need to do now is count only the votes that came in after a specific date. So I can show total votes, and then votes this month. I know there must be an easy way to do this.

View Replies !
Getting The Last Group Of Entries By Date
The part I'm having a brain fart over is how best to determine what's the freshest group of news entries from the db in the most efficient manner. I'm leaning towards using

GROUP BY TO_DAYS(pubdate)
ORDER BY pubdate DESC

which I believe will organize the entries by day of the pubdate in descending order but then I need to create a WHERE clause that will extract the latest group without knowing what the pubdate of the group is.

View Replies !
Auto Fill Date Dropdown List
How would I modify this code to display the years in the dropdown list like so:

current year
2006
2005
back 50 years

<select name="year" id="year">
<?PHP

for($i=date("Y");
$i<=date("Y")+2;
$i++)
if($year == $i)
echo "<option value='$i' selected>$i</option>";
else
echo "<option value='$i'>$i</option>";
?>
</select>

View Replies !
Insert Date To Database Using Dropdown Boxes
I be able to insert the date into my database if i have 3 dropdown boxes wherein it contain the month,day & year. i know the basic of inserting data into my database but with this 3 dropdown box i don't have any idea. after submitting, the data selected on these 3 boxes shall be in one field in my database with fieldname Date.

View Replies !
Date Problems - Get The Date From A MySQL Database
Can you help me i have managed to get the date from a MySQL database but it only uses the first record of the date, and displays the same date on all news items.

View Replies !
UNIX Mktime To MySQL Date Or Date
A form that sends a starting date and an ending date. I have figured out how to tell the difference between the two and even rip the difference into an array because I need to compare the individual dates against a mySQL database to pull results from a particular date in a series. This is no problem. My problem is that teh mySQL database uses DATE as a field definition and this can not be changed. I managed to pull the date differences using some cleaver mktime stuff but no I do not know how to get this 1072242000 into this 2003-12-24...

Is there a function that reverses the mktime result into a usable date format? I would take anything at this point and I can explode and then array it to get what I want - but there has to be something. Code:

View Replies !
Formatting Date From MYSQL Date Field
i've got a date field in my table, but the default format is YYYY-MM-DD... is there any way i can pull the date out of the database and format it differently... like DD.MM.YYYY or like April 13, 2003?

View Replies !
Convert Date To A MySQL Acceptable Date
I've got a date that looks like this: 06/08/2007 AM I'm trying to convert it to a MySQL acceptable date so it can be inserted into the data and read as normal MySQL dates would read so I can use my date searching functions.

I use a lot of -30 days searches and stuff like that. As I insert the records into the database (which come in from a .csv file) the "SCHEDULED_DATE" looks like that above but that, as we all know, won't work with things like 'SCHEDULED_DATE > $onemonth' ($onemonth being a date that is a month ago).

So while the records are imported I have been trying to take that date and convert it into a usable MySQL date. Although my attempts have completely failed. Here is one of the newest things I have used, which didn't work and I really don't know why. Code:

View Replies !
Convert Input Date To Mysql Date
Wanted to see if there was a cleaner way to do this. My form takes a user-input date in the format MM/DD/YYYY. I need to convert that to YYYY-MM-DD to query against my database. The code below works, but basically I take input dates convert them to a UNIX timestamp with strtotime() and then convert them back to the format I need using strftime()

PHP Code:

$format = '%Y-%m-%d'
$startDate =  strtotime($startDate);
$startDate = strftime($format, $startDate);

$endDate =  strtotime($endDate);
$endDate = strftime($format, $endDate);

View Replies !
How To Convert Uk Date To Mysql Date Format
how to convert uk date to mysql date format? I have 3 textboxes having the values of dates. the format are the following:

textbox1-29/08/2007
textbox2-14/08/2007
textbox3-20/08/2007

upon entering it into the database the following dates should be converted already to the mysql date format like 2007-08-29

View Replies !
Make A Dropdown Option Field For User To Select Date?
how can make a dropdown option field for user to select date?

View Replies !
Specify A Date Range And Have Only Entries That Are In That Date Range
I have this database with lots of info all time stamped with this format "May 15 2007  9:44AM".  What I would like to be able to specify a date range and have only entries that are in that date range be pulled from the table so that I can post the results. I know this must be possible but I have no idea host to even start.

View Replies !
Get The Todays Date- Yesterdays Date And Tomorrows Date
I get the todays date- yesterdays date and tomorrows date, like so:

$yesterday = date ("Y-m-d", mktime (0,0,0,date("m"),(date("d")-1),date("Y")));

$tomorrow = date ("Y-m-d", mktime (0,0,0,date("m"),(date("d")+1),date("Y")));

$actualdate = date("Y-m-d");

Which returns the date in the format "200-11-13" But I need to add 13 hours to all three - how owuld I do this?

View Replies !
Sort Results By Date/time, Limit 5 Database Entries Of Today &/or Upcoming Days
I'm designing a website for my fraternity and in the database I have entries which contain past events, todays events, and upcoming events.  My problem is that I can not figure out how to sort the query results to display:
 
1) only past events based on the CURRENT DATE
2) only the events which fall on the CURRENT DATE or after, limiting the results to 5 entries
3) all events that fall on CURRENT DATE or afterwards

Example:   
Today is  September 15, 2007

Problem 1) Displaying all events that happened before September 15, 2007
Problem 2) Displaying only 5 results that fall on September 15, 2007 or after
Problem 3) Displaying all events that are happening on or after September 15, 2007

And obviously I would like the CURRENT DATE to change depending on what date it is, currently.

Ok so now I've been very redundant in my explanation of my problem here is the code and a link to what that particular page looks like. Code:

View Replies !
Put Today's Date Into A MySQL "date" Formated Field
My MySQL table has a field that is set as type "date." I need to get
today's date, and insert it into that field. The default for that MySQL
field is 2006-00-00.

I know about the date() function. I have tried date("Y-m-d") and
date("U"), neither worked. The date field was just filed with all
zeros.

Can anybody point me in the right direction?

View Replies !
Populates The Dropdown With All Entries
So basically want I would like to do is have a drop down in my HTML form which searches a table A and populates the dropdown with all entries in Row B where row C = some varible. I hope this makes sence.

View Replies !
List The The Entries Of The Dropdown Box
How can I list the the entries of the dropdown box (which are all populated) according to the time they are populated.

View Replies !
Check Date From Input Must Greater Or Equal Today Date?
I have 3 select box. Code:

<select name="day">
<option value="1">1</option>
<option value="2">2</option>
.......
<option value="31">31</option>
</select>

<select name="month">
<option value="01"> Jan </option>
<option value="02"> Feb </option>
.....
</select>

<select name="year">
<option value="2002">2002 </option>
<option value="2003">2003</option>
</select>

When I select and click submit in form. I will have 3 variable :

$day, $month and $year

How can I check the day that I choose in form must equal or greater than today date? If it less than today date. I must print error message to user.

View Replies !
Date() Question - Minus One Day Of The Return Date Choose By User
I have a date function, that gets today's date. Then my user can choose a date for the return date. I need to minus one day of the return date for a date_flag , but having trouble. PHP Code:

<?
$date_book = date("Y-m-d H:i:s");

$date_return = $_POST['date_return']; //Returns a date like this 2007-05-25

                         // needs to be date_return - 1 day like 2007-05-24
$date_flag  = mktime(date("Y", $date_return), date("m", $date_return), date("d", $date_return)-1);
?>

View Replies !
Read Today's Date Print Tomorrow's Date
I've got a small script that writes a random number and the date to a text file. Then the script opens this text file and if date = date from this text file something must happen.
If something happened this script must open this text file again and replace it with a new random number and tomorrow's date.

<?php

$date = date("d-m-Y");
mt_srand((double)microtime()*10000000000);
$num=mt_rand(0, 20);
if ($num == $num && $date == "$tomorrowdate") { echo"$num -- $date";}
else
echo " ";?>

So if the script gets activated on the 05-05-2003 it must write tomorrow's date into the text file (06-05-2003). How will I get tomorrow's date today?

View Replies !
Help: Date Function Not Returning Correct Date & Time
I have just notices that the date() function is not returning the correct
date/time on my "server".

I am running apache2 on my winxp pro laptop.

My system clock is set to the correct date, time and timezone, get the
results returned by date() are 11 hours behind.

View Replies !
PHP Date Question: How To Determine The Date Each Of The Past 3 Sundays
How can I determine what the date was (in YYYY-MM-DD format) last
Sunday, and the Sunday before that?

For example:

Today is Thursday, August 18, 2004 (2004-08-18). I would like to have
the following variables:

$this_past_sunday = 2004-08-14
$two_sundays_ago = 2004-08-07
$three_sundays_ago = 2004-07-31

etc. etc.

View Replies !
How To Format The Date To Read Add 1 Hour To The Date Stamp.
i have a field in mysql which contains a timestamp: 2007-07-25 22:52:14 i was going to add a new variable but adding 1 hour to it so it would read: 2007-07-25 23:52:14
im not sure how to format the date to read add 1 hour to the date stamp.

View Replies !
Date Validation - Date In  String Format
i have got an date in  string format  ddmmyyyy (eg: 15052007).i have to validate this date. i have alrady validate this date for a number. now all i have to do is check the day (dd)  against month (mm). example, 29 feb is invalid date, if not a leap year.i have tried to wrote some bit of code but still struggling with it.

View Replies !
Save Date To Table Field Date Type
I have a calendar picker on a form that fills a text box with  XX/XX/XXXX  date format. If I run a insert statement  the date field in the database shows 0000-00-00. If i change the field type to varchar  the correct format displays. 

What is the correct way to save a date to a mysql database?  Furthermore to query on the date  how about a select * from db_name where servicedate >= $startdate  and  servicedate >= $enddate  I supose this will not work
Any pointers?

View Replies !
Start Date - End Date = Number Of Days
I have a starting date for var 1 and today’s date for var 2. I need to calculate how many days are between those two dates.

02/24/03(today) - 01/14/2002(start date) = number of days.

In theory this is easy but there are many instances were I could get an inaccurate answer. For example one consideration is that some months have 30 days others have 31. exc.

My question is, is there an easier way to solve this problem other than using endless if statments to error handle all possible instances? Does PHP4 have any built in functions that could calculate this formula correctly?

View Replies !
Date Using Today's Date And A Number Of Days
I need to have a date using today's date and a number of days:
dateX = todays date - x number of days

can someone give me an example of php code .

I'm using windows, appache server.

View Replies !
Date Functions That Return Date As A String
Does anyone know if there is a date function in php that would return me the date as a string, ie today would be 10 July 2001.

View Replies !
Counting Days From $date To Current Date
how to count the time between two variable dates? Such as someone inputting 6/8/1991 in a form and it comparing that to todays date... then getting the number of seconds elapsed... I know I have to use the mktime() function to get the seconds.. but not quite sure how.

View Replies !
Date Comparison - Checks If A Date Is In Between Two Other Dates
I'm having trouble writing a program that checks if a date is in between two other dates or not.

$today = date("d-m-y");
$a = "09-09-06"; //September 9th, 2006
$c = "09-09-09"; //September 9th, 2009

if($a <= $today && $today<$c){
       echo "Wee";}
else{
echo "Wrong";}

When I try outputting this, it outputs always outputs "Wrong" for some reason, although $today is clearly inbetween $a and $c (Sept.09'06 and Sept.09'09). Am I doing something wrong?

View Replies !
Compare Date Of Today And The Date In The Database
i have a db that stores a date in a table with a specific column.

db=test
table=test_date_compare
column name=date_inserted

ok i hv a php form that allows user to input date and it enters in the above column (date) as in format eg: 21/03/2007

now i wat i would like to do is i would like to compare date of today and the date in the database if it is lesser then todays date it deletes that row of data. deleting the row of data i know how but the problem comes wen coparing the date i dunno how to ...

View Replies !
The Server Date Cant Match With My Country Date.
which using Date()
the server date/time can not match with my country date/time
eg server time: 1.30pm ..but my localtime already 3.3pm

View Replies !
Convert The Date Separator Before Inserting The Date Into The DB
I need to convert the date separator before inserting the date into the DB. Right now, I have 01/01/2006 and I want 01-01-2006. The dates are coming from a CSV and so are an array element. I've tried strrpos and a few other functions trying to just replace the slashes with hypens and that's not working (I think maybe because it's an array and those functions don't work on arrays?) Could someone post example code for something like this?

I have an array called $items[3] that holds the date with the separator mentioned above. I'm sure there are several ways to do it in both php and with mysql functions but I've been stuck on it for a while and REALLY need to get through this for a project I'm working on right now.

View Replies !
Return The Current Date/time Using Date('c')
I'd like to return the date in this format:

2006-05-09T18:00:00-08:00

I've tried using date('c'), but that doesn't appear to be working. Is there another way that I can return the current date/time in this format?

View Replies !
Converting Database Date To Normal Date
I am looking for a way to convert a date that is stored in a MySQL database like this after useing the date() function in PHP:

2006-08-16 21:03:54

and convert it into a date this:

16 August 2006 @ 11:03:54pm

Does anyone have some insight as to how I would go about doing that?

View Replies !
Unix Date Stamp Convert To UK Date
How do I go about converting the Unix date stamp to UK date/month/year. I know how to get the date from the database, I just need to know how I can convert this date using a php script to convert this to UK date format and display on my php page.

View Replies !
Date Different - How To Get Previous Month Of Current Date.
I need your help for datediff of previous month of current date. Example the current date is 2005-07-11. How to get previous month of current date, eg 2005-06-11.

View Replies !
Date Manipulation - Get One Day Less From Current Date
I use date("d/m/Y") for return the current date.

But i need to get one day less.

How can I do that?

View Replies !
Get The Date 6 Months From Current Date?
I'm using PHP 4.4.4. If I have a date of the form

$curDate = date("Y-m-d");

How do I get the date 6 months from this date?

View Replies !
Date() Gives Me Yesterday's Date And Not Today's - Why?
$result[$i]->record_entered contains the current date as set up by
MySQL (entered as "now()").

I verified that in the database the date is "now()", which in this case
will be "2/9/2006".

However, when viewing the page using the display:

Code: ( php )

View Replies !
Begin Date And End Date, But No Weekends!
I am making a system to plan my work days.
If i begin on a project on 01-10-2007, and the project is 100 hour and i work 10 hours a day, it will cost 10 days for me too work.

The answer is simple, project is done @ 10-10-2007, but i dont work in the weekend.
So it must be 12-10-2007, i got the following script;, but it aint working right.

Because when the begin date and end date is more then 2 weeks, and more than 2 weekends, it doenst count the weekends good. Can someone help me, or is there somebody with a better solution? I am working two days on it, but i cant get it right



<?php

$begin_date = strtotime( date( '2007-10-01' ) );

$hours = 100;
$workdays = 10;

$total_days = $hours / $workdays; 
$total_days *= (60 * 60 * 24);

$weekend = $total_days / 7 * 2;

$enddate = $begin_date + $total_days + $weekend;

if( date('D', $enddate ) == 'Sat' ) {
echo 'End date <b>' . date('d-m-Y', $enddate + (2*86400)) . '</b> 2 days<br /><br />';
}

elseif( date('D', $enddate ) == 'Sun' ) {
echo 'End date <b>' . date('d-m-Y', $enddate + (1*86400)) . '</b> 1 day<br /><br />';
}

else
{
echo 'End date <b>' . date('d-m-Y', $enddate) . '</b><br /><br />';
}

?>

View Replies !
Date Conversions ( Date, Mktime )
I have a date in three pieces dd mm yyyy.
I'm just wondering the best way to convert this for inserting into a
DATETIME field and then back again when displaying it.

I have tried date, strtotime mktime but it keeps inserting a blank
date. i.e. 00:00:00 00:00...

I've been looking through the php manual but I can't seem to get this
working.
Also would I be better off using the UNIX_TIMESTAMP function?

View Replies !
Php Date - Check If The Date Has Been Added
I return a date from a databse and want to check if the date has been added (ie: not 0000-00-00, which most are). Whats the best way to check if the date is not this?

View Replies !
Check Date Is Not Before Current Date
I need to validate a date entered to make sure it isnt before the current date.

I have managed to this in Javascript but not sure how to do this in PHP when the value is submitted.

View Replies !
Display The Date As A Real Date Xx/xx/xx
Basically im putting a join date into the database but i don't want it displayed as a date, i want it as pure numbers so that i can use it to work out things such as how long they've been a member, comments per day (by dividing the posts by how many days they've been a member) ect ect

So whats the best way of putting that into the database? I have a vBulletin forum and looked in the database at what they had for the join date and i saw stuff like 112823... is that seconds or something?

I also need to display the date as a real date xx/xx/xx so that must be possible aswell.

View Replies !
Date Time Not Accurate For Date();
echo "date=".date('Y-m-d h:i:s');
date=2007-11-15 15:48:14

the clock is the accurate at here..showing only 3pm ..while now my pc showing 11.51pm(localtime)

View Replies !
Re-arranging The Date Without Time() Or Date?
I have dates logged in a MySQL table of when people are logged in in my site, the date gets entered into the table like so: 2007-01-17 19:18:58, i am using MX Kollection for Dreamweaver to create the site so I cant really change the fields to integar and use the time() function as it comes built with the extension Code:

View Replies !
Order By Date When Date Not A Timestamp
I have a database of items with 2 fields, LogDate and LogTime.

I would like to be able to display these items ordered newest to oldest.

LogDate is a VarChar(11) and the format of the data is always DD-MMM-YYYY (30-AUG-2006)
LogTime is a VarChar(7) and the format is always HH:MMAP (02:47pm)

How can I order my SQL to sort by those 2 fields as if they were real dates?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved