:: Forum >> Version 1 >>

display data from database into a Grid

More information on this topic is available in the documentation section: /active.howto.load.csv/.

How to display data from database(SQL- Server ) in the Grid?
Mohan
Saturday, June 25, 2005
I suppose you could pass in a function that returns the data in xml format.
Thursday, December 22, 2005
simple way using php

php code for a data.php file
<?php 
function db_connect() { 
  
$database_name 'xxxxxxx'// Set this to your Database Name 
  
$database_username 'xxxxxxx'// Set this to your MySQL username 
  
$database_password 'xxxxxxx'// Set this to your MySQL password 
  
$result mysql_pconnect('localhost',$database_username$database_password); 
  if (!
$result) return false
  if (!
mysql_select_db($database_name)) return false
  return 
$result


$conn db_connect(); // Connect to database 

$query "select * from GUEST";

if (
$conn) { 
  
$result mysql_query($query,$conn);
  
$nf mysql_num_fields($result);
  
$nr mysql_num_rows($result);
  for(
$i=0;$i<$nr;$i++){
    
$row mysql_fetch_array($resultMYSQL_NUM);
    for(
$j=0;$j<$nf;$j++){
      echo 
$row[$j] . "\t";
    }
    echo 
"\n";
  } 
}
?>
 
And you call it with your grid

var table = new AW.CSV.Table;
  
table.setURL("data.php");
  
table.request();
..........
 
simple example without using XML. hopes this helps

David Gutierrez
Friday, December 23, 2005
Can I display data from DB2 database?
Emman
Wednesday, December 28, 2005
yes, just use the apropriate php code ( which I do not know sence I never used that ibm product with php before)
David Gutierrez
Wednesday, December 28, 2005
For the record, you can use ANY database.
Run your query and format the returned data into format suitable for AW.
The data can be formatted into XML,CSV,TAB, or even JS code.
Tony
Wednesday, December 28, 2005
How do I assign this table to a grid, in version 2.0?
Andrew
Tuesday, January 3, 2006
Can u plz tell me why this error comes up:
"AW" is undefined
BDC
Thursday, January 5, 2006
show your code and we can help
David Gutierrez
Thursday, January 5, 2006
I am getting an error:"AW is undefined"

My code:

<html>
<head>
<title>ActiveWidgets Grid :: Examples</title>
<style> body, html {font: menu; background: threedface;} </style>

<!-- ActiveWidgets stylesheet and scripts -->
<link href="../../runtime/styles/classic/grid.css" rel="stylesheet" type="text/css" ></link>
<link href="../../runtime/styles/classic/aw.css" rel="stylesheet" type="text/css" ></link>
<script src="../../runtime/lib/grid.js"></script>


<style>

.active-controls-grid {height: 100%; font: menu;}

.active-column-0 {width: 80px;}
.active-column-1 {width: 200px; background-color: threedlightshadow;}
.active-column-2 {text-align: right;}
.active-column-3 {text-align: right;}
.active-column-4 {text-align: right;}

.active-grid-column {border-right: 1px solid threedshadow;}
.active-grid-row {border-bottom: 1px solid threedlightshadow;}
.active-templates-input {
overflow: hidden;
width: 100%;
height: 100%;
padding: 0px 5px;
margin: -1px 0px;
border: 1px solid #666;
vertical-align: middle;
font: menu;
line-height: 1.4em;
}

.active-templates-input.gecko {
display: block;
margin: 0px;
}
</style>
</head>
<body>
<!--load data from db-->
<script>


var table = new AW.CSV.Table;
table.setURL("data.php");


table.request();

var obj = new Active.Controls.Grid;
obj.setProperty("column/count", 5);
obj.setModel("data", table);

document.write(obj);
</script>

</body>
</html>
Friday, January 6, 2006
how to define query able data grid of using javascript and xml
susi
Thursday, June 29, 2006



This topic is archived.

Back to /active.howto.load.csv/

Documentation:

Forum search