The type is 'date' and default it '0000-00-00', does that help?
The type is 'date' and default it '0000-00-00', does that help?
Then you would want something like this (for the form that is):
and this for search.php:Code:<form action="search.php" method="POST"> Brithday Month: <select name="month"> <option>Select A Month</option> <option value="01">January</option> <option value="02">February</option> <option value="03">March</option> <option value="04">April</option> <option value="05">May</option> <option value="06">June</option> <option value="07">July</option> <option value="08">August</option> <option value="09">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <input type="submit" value="Search"> </form>
Hope this helps.Code:<?php $month = $_REQUEST['month']; $info = mysql_query("SELECT * FROM `table` WHERE `birthday` LIKE '%$month%'"); /* Rest of php code here */
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Hmmm it's spitting out an error... I think I might have put the code wrong somewhere...PHP Code:<?php
/* connect to the mysql database and use a query to get the members info */
include 'library/config.php';
include 'library/opendb.php';
//navigation
include("nav.php");
//assign the bday variable.
$month = $_REQUEST['month'];
//birthday search
$info = mysql_query("SELECT * FROM `tblmembers` WHERE `DateOfBirth` LIKE '%$month%'");
$info = mysql_query($sql);
echo '<table border="1" cellpadding="3" cellspacing="1">
<tr valign="top">
<td>First Name</td>
<td>Last Name</td>
<td>DateOfBirth</td>
<td>Last Login</td>
</tr>';
if (mysql_num_rows($info) < 1) {
echo '<tr valign="top">
<td colspan="4">There are no members that match the query. Please go back and try again</td>
</tr>';
}
else {
while ($qry = mysql_fetch_array($info)) {
//create the layout
?>
<link href="cs_style.css" rel="stylesheet" type="text/css" />
<tr valign="top">
<td><?php echo $qry['FirstName']; ?></td>
<td><?php echo $qry['LastName']; ?></td>
<td><?php echo $qry['DateOfBirth']; ?></td>
<td><?php echo $qry['State']; ?></td>
</tr>
<?php
}
}
echo '</table>';
?>
What's the error, that way we could pinpoint it in the code.
EDIT: Nevermind, in your code above, you have 2 mysql_query's. Get rid of the second one (or the one that looks like this):
Hope this helps.Code:$info = mysql_query($sql);
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
I'm slow sorry... Ok all worked! But I lost my date/time format... Any ideas?
PHP Code:echo $qry['loginDateTime'];
echo($qry['loginDateTime']?date('d/m/Y H:i:s', strtotime($qry['loginDateTime'])):'unknown')
To get your date/time format back, you could probably use the following:
in place of the part in red below:Code:echo date('d/m/Y H:i:s', strtotime($qry['DateOfBirth']));
Hope this helps.Code:<?php /* connect to the mysql database and use a query to get the members info */ include 'library/config.php'; include 'library/opendb.php'; //navigation include("nav.php"); //assign the bday variable. $month = $_REQUEST['month']; //birthday search $info = mysql_query("SELECT * FROM `tblmembers` WHERE `DateOfBirth` LIKE '%$month%'"); $info = mysql_query($sql); echo '<table border="1" cellpadding="3" cellspacing="1"> <tr valign="top"> <td>First Name</td> <td>Last Name</td> <td>DateOfBirth</td> <td>Last Login</td> </tr>'; if (mysql_num_rows($info) < 1) { echo '<tr valign="top"> <td colspan="4">There are no members that match the query. Please go back and try again</td> </tr>'; } else { while ($qry = mysql_fetch_array($info)) { //create the layout ?> <link href="cs_style.css" rel="stylesheet" type="text/css" /> <tr valign="top"> <td><?php echo $qry['FirstName']; ?></td> <td><?php echo $qry['LastName']; ?></td> <td><?php echo $qry['DateOfBirth']; ?></td> <td><?php echo $qry['State']; ?></td> </tr> <?php } } echo '</table>'; ?>
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
I don't know what I am doing today! My posts aren't posting properly or something... What it does is sort them, but it adds both the month and the day as the result. So say I search February, it adds Member 1, 12/03/1980 and also Member 2, 27/12/1973... See what it's doing any idea why?
I get an error message on people that were born beofre 1970... That's wierd, surely you can display birthdays prior to that?
Warning: date(): Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in \birthdaysearch.php on line 41
Taken from the php.net website:
That's for version 5.1.0 and later. What version are you running and what OS is it? That could be the reason why you are getting that error.The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). However, before PHP 5.1.0 this range was limited from 01-01-1970 to 19-01-2038 on some systems (e.g. Windows).
Hope this helps.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Ahhhhh damn it's a Windows server... So is there no workaround?
Bookmarks