SELECTING column FROM TABLE does not work
Posted by: kevylyap
Posted on: 2008-11-28 04:12:00
Hi all,
I have a query which I want to recall from mysql tables. But there seems to be an error in it.
My code as follows:
<?php
//Query for references for herb
$refherb_1 = 'SELECT refherb_1 FROM cam_pk WHERE acronym = "'.$CAM.'"';
$refherb_2 = 'SELECT refherb_2 FROM cam_pk WHERE acronym = "'.$CAM.'"';
$refherb_3 = 'SELECT refherb_3 FROM cam_pk WHERE acronym = "'.$CAM.'"';
$refherb_1_result = mysql_query($refherb_1);
$refherb_2_result = mysql_query($refherb_2);
$refherb_3_result = mysql_query($refherb_3);
foreach (mysql_fetch_row($refherb_1_result) as $refherb_1_output)
{ }
foreach (mysql_fetch_row($refherb_2_result) as $refherb_2_output)
{ }
foreach (mysql_fetch_row($refherb_3_result) as $refherb_3_output)
{ }
//in a results table cell I enter the following code
if ($refadr_1_output == 'N/A' OR $refadr_1_output == ''):
echo "";
elseif ($refadr_2_output == ''):
echo $refadr_1_output;
elseif ($refadr_3_output == ''):
echo $refadr_1_output;
echo "<br />" . $refadr_2_output;
else:
echo $refadr_1_output;
echo "<br />" . $refadr_2_output;
echo "<br />" . $refadr_3_output;
endif;
?>
Somehow, my results for $refadr_2_output and $refadr_3_output can be seen, but not for the first $refadr_1_output
Can anyone help troubleshoot?
Thanks a lot