I am not sure if this has any significance - but isn't 31 Dec 1969 the day before the UNIX epoch (1 Jan 1970 - i think)?
Jordan, how are the dates stored in the database - as dates or unix timestamps? Also, the function fixDate isn't in the online PHP manual - is it a function defined by you? - could that not be doing something weird? Rory McKinley Nebula Solutions +27 82 857 2391 [EMAIL PROTECTED] "There are 10 kinds of people in this world, those who understand binary and those who don't" (Unknown) ----- Original Message ----- From: "Diana Soares" <[EMAIL PROTECTED]> To: "Jordan Morgan" <[EMAIL PROTECTED]> Cc: "mysql" <[EMAIL PROTECTED]> Sent: Friday, October 10, 2003 8:58 AM Subject: Re: newbie select statement question > Look at: > > if ($tenureid=3) > > You're not comparing $tenureid with 3, you're assigning 3 to > $ternureid... If you want to compare both values, you must use the > operator "==" (and not only "="). > > > On Fri, 2003-10-10 at 05:43, Jordan Morgan wrote: > > Hi, > > > > I have the following statement: > > > > echo "$tenureid<P>"; > > > > if ($tenureid=3) > > { > > // get faculty employment record - award date > > $sql = "select TD.Award_Date from TenureDescription TD LEFT JOIN InstitutionEmployment IE on TD.TenureDescriptionID=IE.Tenure WHERE IE.FacultyMember='$fid'"; > > $result = mysql_db_query($database, $sql, $connection) or die ("Error in query: $sql. " . mysql_error()); > > > > // obtain data from resultset > > list($tenuredate) = mysql_fetch_row($result); > > > > echo "<B>Date Tenure Granted</B>: "; > > echo fixDate($tenuredate); > > echo "<P>"; > > } > > else { > > > > echo "<B>Date Tenure Granted</B>: Null<P>"; > > } > > > > and I can't figure out why I always get the following result: > > > > ---------------------------------------------------------------- > > 2 > > > > Date Tenure Granted: 31 Dec 1969 > > --------------------------------------------------------------- > > or > > ---------------------------------------------------------------- > > 1 > > > > Date Tenure Granted: 31 Dec 1969 > > --------------------------------------------------------------- > > > > when 1) tenureid <> 3, and 2) no 31 Dec 1969 date in the database anywhere. > > > > The only thing I can think of is that I modified the dropdown box for the tenure date on the data entry page like this: > > > > <tr> > > <td>Date Tenure Granted<br><font size="-2">(in mm-dd-yyyy format)</font></td> > > > > <td> > > <select name="tmm"> > > <option value="0" selected='selected'></option> > > <? for ($x=1; $x<=12; $x++) { echo "<option value=\"" . sprintf("%02d", $x) . "\">" . sprintf("%02d", $x) . "</option>"; } ?> > > </select> - > > <select name="tdd"> > > <option value="0" selected='selected'></option> > > <? for ($x=1; $x<=31; $x++) { echo "<option value=\"" . sprintf("%02d", $x) . "\">" . sprintf("%02d", $x) . "</option>"; } ?> > > </select> - > > <select name="tyyyy"> > > <option value="0" selected='selected'></option> > > <!-- display from 1970 to (current year) --> > > <? for ($x=(date("Y", mktime())); $x>=1970; $x--) { echo "<option value=$x>$x</option>"; } ?> > > </select> > > </td> > > </tr> > > > > by adding <option value="0" selected='selected'></option> to those 3 fields as I want null to be a default selection. but I can't imagine why that'll mess up the if statement evaluation. > > > > It seems that the 1st if statement just runs whatever the tenureid is. > > > > Can anyone help me on this? I'm using PHP 4.2.2 and MySQL 3.23.54 btw. > > > > Thanks millions! > > > > Jordan > > > > > > > > > -- > Diana Soares > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]