php 7.3.x
oracle : 19.3기존 oracle 사용자 추가 및 테이블 생성 데이터 입력은 아래 링크에서 작업 후 진행
https://xinet.kr/?p=3173oracle test page
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
<title>Oracle in PHP test page</title> <h1>PHP Access an Oracle database</h1> <?php $conn = oci_connect('jsh','qwer1234#$','localhost/orcl','UTF8'); // prepare the query $stmt = "SELECT s.student_no, surname, forename, module_code, mark FROM students s, marks m WHERE module_code = 'CM0001' AND m.stude nt_no = s.student_no ORDER BY mark DESC"; $stid = oci_parse($conn, $stmt); // execute the query if( !oci_execute($stid) ) { $e = oci_error(); echo htmlentities($e['message'], ENT_QUOTES); oci_close($conn); } else { // retrieve the results print "<table cols=5 border=1>\n"; print "<thead>\n"; print "<tr>\n"; print "<th width=120 height=30 align=center> Student ID</th>\n"; print "<th width=150 height=30 align=center> Surname</th>\n"; print "<th width=120 height=30 align=center> Forename</th>\n"; print "<th width=120 height=30 align=center> Module</th>\n"; print "<th width=100 height=30 align=center> Mark</th>\n"; print "</tr>"; print "</thead>"; while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) { echo "<tr>\n"; foreach ($row as $item) { echo " <td align=center>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>\n"; } echo "</tr>\n"; } oci_close($conn); echo "</table>\n"; } ?> |