简体   繁体   中英

Using odbc_result to display multiple table select statement

I have a query :

$sql="SELECT * FROM LAF_INFO, SIGNATURE_INFO WHERE LAF_INFO.LAF_NO = SIGNATURE_INFO.LAF_NO";

It brings the data but I cannot figure out how to display it in PHP.

$rs=odbc_exec($conn,$sql);
if (!$rs) {
  exit("Error in Database Connection");
}
 while (odbc_fetch_row($rs)) {  
         $date_raw = odbc_result($rs, "LAF_INFO.DATE_LAF");
         echo $date_raw
   }

It gives error.

//Warning: odbc_result() [function.odbc-result]: Field LAF_INFO.DATE_LAF not found in path

The table has field DATE_LAF . It works fine if I just use one table for select.

any idea how to display.

You are selecting DATE_LAF, therefore you should change your code to:

$rs=odbc_exec($conn,$sql);
if (!$rs) {
  exit("Error in Database Connection");
}
 while (odbc_fetch_row($rs)) {  
         $date_raw = odbc_result($rs, "DATE_LAF");
         echo $date_raw
   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM