Jump to content

checking if statement


jacko_162

Recommended Posts

i have the following if statement which works perfect;

 

<?php
$val1 = '379'; //----- CHANGE LOW VALUE
$val2 = '391'; //----- CHANGE HIGH VALUE
$val3 = '$test10';  //----- CHANGE TEST NUMBER
$label = 'Potassium: '; //----- CHANGE TEST LABEL
if (in_array('test10',$arr)){ //----- CHANGE TEST NUMBER
echo '<tr>';
echo "<td width='40%' align='right'><em><strong>$label</strong></em></td>";
echo "<td width='15%'>$test10 ppm</td>"; //----- CHANGE TEST NUMBER
if (($test10 > $val1) && ($test10 < $val2)) {
echo '<td width="15%"><img src="img/icons/beaker_green.png" /></td>';}
else {
echo '<td width="6%"><img src="img/icons/beaker_red.png" /></td>';}
echo '</tr>';
}else{
echo '';}
?>

 

what i wanted to do next was not only check if 'test10' was in the array but also that $active10 had a '1' value in the database.

 

so i tried the following;

 

if (in_array('test10',$arr) && ($active10 = '1')){

 

but even if the $active10 variable had a '0' in database it still shows?

 

i have assigend $active10 variable in the top of the php page like follows;

 

<?php
  if ($ID) {
    $sql = "SELECT * FROM $table2 WHERE ID=$ID AND member_id=$_SESSION[sESS_MEMBER_ID]";
    $result = mysql_query($sql);
    $myrow = mysql_fetch_array($result);
    $ID = $myrow["id"];
    $member_id = $myrow["member_id"];
    $test10 = $myrow["test10"];
    $active10 = $myrow["active10"];

  {
    $result2=mysql_query("SELECT * FROM $table3 WHERE member_id=$_SESSION[sESS_MEMBER_ID]");
    $row2 = mysql_fetch_array($result2);
    $arr = array();
    $arr = explode(';',$row2['settings']);
?>

 

can anyone help me word it rightly please?

Link to comment
https://forums.phpfreaks.com/topic/198215-checking-if-statement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.