...

View Full Version : if else... I'm going mad



h8ids
07-19-2007, 09:16 PM
I have the following:


if ($myrow["Locked"] == 'YES'){
if ($myrow["RevisionStage"]["ProfViewed"] == "YES") {
echo "<a href=statuspage_2.php?Records=".$Records." style='text-decoration: none; color: #FF0000'> Check review status.</a>";
} else {
echo "<a href=statuspage_2.php?Records=".$Records." style='text-decoration: none; color: #000000'> Check review status.</a>";
}
} else {
echo " <a href=addedit_2.php?Records=".$Records.">Edit</a> |
<a method='POST' href=emailconfirm_2.php?Records=".$Records.">Submit</a> |
<a href=delete_2.php?Records=".$Records.">Delete</a>";
}

I'm attempting to edit the following line so that both fields, RevisionStage and ProfViewed, will be checked at the same time.

if ($myrow["RevisionStage"]["ProfViewed"] == "YES") {

Presently the page loads without error but the above code seems to be ignored; the color of "Check review status." is remaining black.

Attempted the following. But I'm definitely missing the correct syntax.
($myrow["RevisionStage"]["ProfViewed"] == "YES")
($myrow["RevisionStage"],["ProfViewed"] == "YES")
($myrow(["RevisionStage"],["ProfViewed"]) == "YES")
($myrow["RevisionStage","ProfViewed"] == "YES")
($myrow["RevisionStage,ProfViewed"] == "YES")
($myrow["RevisionStage"]&&["ProfViewed"] == "YES")

Thanks in advance.

rafiki
07-19-2007, 09:19 PM
($myrow['RevisionStage']['ProfViewed'] == "YES")

Fumigator
07-19-2007, 09:28 PM
$myrow["RevisionStage"]["ProfViewed"] is attempting to reference a 2-dimensional array value (which is not defined I presume). You must do specify both variables you want to check:


if ($myrow['RevisionStage'] == "YES" && $myrow['ProViewed'] == "YES") {
....
}

h8ids
07-19-2007, 09:33 PM
Thanks guys!:thumbsup:

You have saved my sanity!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum