Re: More include issues

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

 



Stut wrote:
Dan Shirah wrote:
Ask and you shall recieve!! :)
// My include statement at the beginning of the body
<?php include '../../Conn/prpr_mssql.php'; ?>
**Various plain HTML form data here** // My dropdown box that is not getting populated
<?php
  // Query the credit_card_type table and load all of the records
  // into an array.
$sql = "SELECT * FROM credit_card_code_types ORDER BY credit_card_type_desc";
  $res = mssql_query($sql) or die(mssql_error());
  while ($rec = mssql_fetch_assoc($res)) $credit_card_type_desc[] = $rec;
// die('<pre>'.print_r($credit_card_type_code)); foreach ($credit_card_type_desc as $c)
  {
    if ($c['credit_card_type_code'] == $_POST['credit_card'])
echo "<OPTION value=\"{$c['credit_card_type_code']}\" SELECTED>{$c['credit_card_type_desc']}</OPTION>\n";
    else
echo "<OPTION value=\"{$c['credit_card_type_code']}\">{$c['credit_card_type_desc']}</OPTION>\n";
  }
?>

Ok, I can't see anything wrong with that. Are you absolutely sure it works when you replace the include line with the contents of the include file? Are you sure you're replacing it exactly?

One minor thing... that include file is not the same path and filename you gave in your original post. You are looking at the right piece of code yes?

but he said that he echo'ed something from the include file.

Which file was it called from?


One thing I'd suggest you add is a check after the mssql_query to see how many rows were returned. Beyond that I'm stumped.

-Stut



I'm thinking this is a scope issue

are either of these two pieces of code being called from within a function or class?

the display code, or the include statement? was it

../../Conn/prpr_mssql.php

or

../../Connections/connection.php

Which file did you have the include statement in?

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux