3.2.0

how to connect with function ora

why this script doesnt success?
can someone help me?

<?php
$user="cdm";
$pass="pwd";

$link =ora_logon($user,$pass);
$kursor=ora_open($link);
if (!$kursor) {
die('Could not connect: ' . ora_error());
}
echo 'Connected successfully';
$query = 'SELECT * FROM SD_HUA';
ora_parse($kursor,$query);
ora_exec($kursor);

// print MySQL query results as 2D javascript array
function aw_cells($kursor){

$rows = array();
while ($record = ora_fetch($kursor)) {
$cols = array();
foreach ($record as $value) {
$cols[] = '"'.addslashes($value).'"';
}
$rows[] = "\t[".implode(",", $cols)."]";
}
echo "[\n".implode(",\n",$rows)."\n];\n";
}

// print MySQL field names as javascript array
function aw_headers($kursor){
while ($field = ora_fetch($kursor)) {
$cols[] = '"'.$field->name.'"';
}
echo "[".implode(",",$cols)."];\n";
}

?>
<html>
<head>
<!-- include AW stylesheet and script -->
<link href="../../runtime/styles/xp/aw.css" rel="stylesheet" type="text/css" ></link>
<script src="../../runtime/lib/aw.js"></script>
</head>
<body>
<script>

// insert javascript arrays produced by PHP functions
var myHeaders = <?= aw_headers($kursor) ?>
var myCells = <?= aw_cells($kursor) ?>

// create grid control
var obj = new AW.UI.Grid;

// set grid text
obj.setHeaderText(myHeaders);
obj.setCellText(myCells);

// set number of columns/rows
obj.setColumnCount(myHeaders.length);
obj.setRowCount(myCells.length);

// write grid to the page
document.write(obj);

</script>
</body>
</html>
nina
July 10,

This topic is archived.

See also:


Back to support forum