Totally lost on why If statement doesn't work to call query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This works:
If("C"=="C")
{
//query and display here
}
This works:
If("C"=="D")
{
//query and display here (won't happen)
}
In other words the query inside the If clause runs or not, depending on the logic.
But, when I initialize $z=odbc_result($data5,"SystemType"); and $thissystem="C" then this doesn't work:
If($z==$thissystem)
{
//query and display here
}
I've echoed all the values to the page to make sure they are there. What the heck is going on? (please)
Here is the whole block of code that runs or doesn't. I've spent hours trying to figure out why it doesn't work even when the code itself without the If statement works:

$data5=odbc_do($connectionSDS,"SELECT SystemType FROM orweb.dbo.InventoryTiny WHERE PWS='$pwsno'");
$z=odbc_result($data5,"SystemType");
$thissystem="C";
echo $z;  //returns "C"
echo "<br>";
echo $thissystem;  //returns "C"
echo "<br>";
If($z==$thissystem)
{
$data6=odbc_do($connectionSDWIS,"EXEC orweb.jdavis.sp_CCR '$pwsno'");
echo "<table width=70%>\n";
echo "<th colspan=3 bgcolor=lightblue>Consumer Confidence Reports</th>";
echo $trcenter;
echo "<td><u><b>For Year</b></u></td><td><u><b>Date Received</b></u></td><td><u><b>Date Certified</b></u></td>";
echo "</tr>";
do
  {
  echo $trcenter;
  $fields=odbc_num_fields($data6);
  for($i=1 ; $i<=$fields ; $i++)
  echo "<td nowrap>".odbc_result($data6,$i)."</td>";
  echo "</tr>\n";
  } while(odbc_fetch_row($data6));
echo "</table>";
}

echo "(Only Community water systems require a Consumer Confidence Report)";

		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux