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]