2016-08-11 11 views
0


クエリ結果をWebテーブルに表示しようとしていますが、unidentified index (column name)があります。
odbc_fetch_arrayでハイパーリンクを追加する

マイコード:

$results = 0; 
 
$resultset=odbc_exec($conn, "SELECT qem_message.createdate as Tanggal, qem_message.agent_key, qem_message.trackingnumber, qem_message.subject, qem_message.currentstatus, qem_messagestatlog.createdate as Last from qem_message, qem_messagestatlog where qem_message.currentmsglog_key = qem_messagestatlog.pkey and qem_message.createdate between '$tgl1' and '$tgl2' order by qem_message.createdate desc "); 
 
echo "<p align='center'><table border='1' cellpadding='2'></p>"; 
 
echo "<tr> <th>Tanggal</th> <th>Agent</th> <th>Tracking Number</th> <th>Subject</th> <th>createdate</th></tr>"; 
 
while($row = odbc_fetch_array($resultset)) { 
 
\t \t $results += 1; 
 
\t \t if($i%2 == 1) $color = $color1; 
 
\t \t else $color = $color2; 
 
\t \t echo "<tr style='background-color: $color'>"; 
 
\t \t echo "<td>" . $row['createdate'] . "</td>"; 
 
\t \t echo "<td>" . $row['agent_key'] . "</td>"; 
 
\t \t echo "<td>" . $row['trackingnumber'] . "</td>"; 
 
\t \t echo "<td>" . $row['subject'] . "</td>"; 
 
\t \t echo "<td>" . $row['createdate'] . "</td>"; 
 
\t \t echo "</tr>"; 
 
\t \t $i++; 
 
\t } 
 
\t echo "</table>"; 
 
odbc_close($conn); \t

また、私は第3列trackingnumberへのハイパーリンクを追加したいです。
コードを修正してください。私はphp 5.4mssql server 2005を使用しています。

答えて

0

それが今

$resultset=odbc_exec($conn, "SELECT qem_message.createdate as Tanggal, qem_message.agent_key, qem_message.trackingnumber, substring(qem_message.messagebody, PATINDEX('%LANGUAGE%', qem_message.messagebody)-11,10) as ID , qem_message.subject, qem_message.currentstatus, qem_messagestatlog.createdate as Last from qem_message, qem_messagestatlog where qem_message.currentmsglog_key = qem_messagestatlog.pkey and qem_message.createdate between '$tgl1' and '$tgl2' order by qem_message.createdate desc "); 
 
echo "<p align='center'><table border='1' cellpadding='2'></p>"; 
 
echo "<tr> <th>Tanggal</th> <th>Agent</th> <th>Tracking Number</th> <th>id</th> <th>Subject</th> <th>Last Update</th></tr>"; 
 
while(odbc_fetch_array($resultset)) { 
 
\t \t //$results += 1; 
 
\t \t if($i%2 == 1) $color = $color1; 
 
\t \t else $color = $color2; 
 
\t \t echo "<tr style='background-color: $color'>"; 
 
\t \t echo "<td>" . odbc_result($resultset, "Tanggal") . "</td>"; 
 
\t \t echo "<td>" . odbc_result($resultset, "agent_key") . "</td>"; 
 
\t \t echo "<td>" . "<a href='email_trace_pop.php?trackingnumber=" . odbc_result($resultset, "trackingnumber") ."' target=\"popup\" onclick=\"window.open('email_trace_pop.php?trackingnumber=" . odbc_result($resultset, "trackingnumber") ."','name','width=400,height=400',)\" >" . odbc_result($resultset, "trackingnumber") . "</a></td>"; 
 
\t \t echo "<td>" . odbc_result($resultset, "id") . "</td>"; 
 
\t \t echo "<td>" . odbc_result($resultset, "subject") . "</td>"; 
 
\t \t echo "<td>" . odbc_result($resultset, "Last") . "</td>"; 
 
\t \t echo "</tr>"; 
 
\t \t $i++; 
 
\t } 
 
\t echo "</table>"; 
 
odbc_close($conn); \t

の作品
関連する問題