Re: newbie select statement question
Hi Jordan Have had a look at the date input page, and the source code that it produces looks fine. If you still haven't sorted it out could I suggest the following: Output the tenure date at the following points in the application: 1) When it is returned by the input form. 2) When it is returned from the database (before being input into fixdate()). 3) Within fixdate. See if the results are consistent throughout. 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: Jordan Morgan [EMAIL PROTECTED] To: Nobody [EMAIL PROTECTED] Cc: Diana Soares [EMAIL PROTECTED]; mysql [EMAIL PROTECTED] Sent: Friday, October 10, 2003 2:24 PM Subject: Re: newbie select statement question The date is stored as dates instead of timestamps. Yes, that fixDate function is defined by me and it worked great with other dates I have stored. I'm really thinking my dropdown fields for the MM, DD, and on the data entry page has somethng wrong with it. do you think so? ps: thanks for checking for me btw. Nobody wrote: 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 $tenureidP; 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 BDate Tenure Granted/B: ; echo fixDate($tenuredate); echo P; } else { echo BDate Tenure Granted/B: NullP; } 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 tdDate Tenure Grantedbrfont size=-2(in mm-dd- 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=t 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] -- Jordan
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 $tenureidP; 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 BDate Tenure Granted/B: ; echo fixDate($tenuredate); echo P; } else { echo BDate Tenure Granted/B: NullP; } 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 tdDate Tenure Grantedbrfont size=-2(in mm-dd- 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=t 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]
Re: newbie select statement question
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 $tenureidP; 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 BDate Tenure Granted/B: ; echo fixDate($tenuredate); echo P; } else { echo BDate Tenure Granted/B: NullP; } 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 tdDate Tenure Grantedbrfont size=-2(in mm-dd- 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=t 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]
Re: newbie select statement question
oh thanks! I guess that's why I'm a newbie. Diana Soares wrote: 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 $tenureidP; 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 BDate Tenure Granted/B: ; echo fixDate($tenuredate); echo P; } else { echo BDate Tenure Granted/B: NullP; } 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 tdDate Tenure Grantedbrfont size=-2(in mm-dd- 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=t 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] -- Jordan Morgan Information Analyst - GeorgiaFIRST HRMS Project Board of Regents Office of Information and Instructional Technology 1865 West Broad Street, Athens, GA 30606-3539 Phone: (706) 369-6232 Fax: (706) 369-6429 mailto:[EMAIL PROTECTED] http://www.usg.edu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: newbie select statement question
The date is stored as dates instead of timestamps. Yes, that fixDate function is defined by me and it worked great with other dates I have stored. I'm really thinking my dropdown fields for the MM, DD, and on the data entry page has somethng wrong with it. do you think so? ps: thanks for checking for me btw. Nobody wrote: 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 $tenureidP; 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 BDate Tenure Granted/B: ; echo fixDate($tenuredate); echo P; } else { echo BDate Tenure Granted/B: NullP; } 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 tdDate Tenure Grantedbrfont size=-2(in mm-dd- 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=t 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] -- Jordan Morgan Information Analyst - GeorgiaFIRST HRMS Project Board of Regents Office of Information and Instructional Technology 1865 West Broad Street, Athens, GA 30606-3539 Phone: (706) 369-6232 Fax: (706) 369-6429 mailto:[EMAIL PROTECTED] http://www.usg.edu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]