Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001072

Re: [PHP-DB] Need syntax for conditional in recordset loop From: Dobromir Velev (diadomraz <email protected>)
Date: 07/17/01

Hi,
You could use something like

#start
do
  {
  echo "<tr>";
  $fields=odbc_num_fields($data2);
  for($i=3 ; $i<=$fields ; $i++)
    echo "<td nowrap>";
    if (odbc_result($data2,$i) = 'SOX')
      echo "<a href='sox_page_url'>".odbc_result($data2,$i)."</a>";
    else
       echo odbc_result($data2,$i);
  echo "</td></tr>\n";
  } while(odbc_fetch_row($data2));
echo "</table>";
#end

The idea is to output one thing when the result matches your criteria and
another when it doesn't.

Hope this helps
Dobromir Velev

-----Original Message-----
From: John A DAVIS <John.A.DAVIS <email protected>>
To: php-db <email protected> <php-db <email protected>>
Date: Tuesday, July 17, 2001 2:39 AM
Subject: [PHP-DB] Need syntax for conditional in recordset loop

How would I code "IF .odbc_result($data2,$i) = 'SOX' THEN make it a link"?
By link I mean that I want the word "SOX" highlited in blue and underlined
and referencing a webpage that explains SOX verbosefully. Don't know PHP IF
THEN syntax too well.

/* fill table with data */
do
  {
  echo "<tr>";
  $fields=odbc_num_fields($data2);
  for($i=3 ; $i<=$fields ; $i++)
  echo "<td nowrap>".odbc_result($data2,$i)."</td>";
  echo "</tr>\n";
  } while(odbc_fetch_row($data2));
echo "</table>";

John A. Davis
Information Systems Specialist
OHD DWP
State of Oregon

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>