Sigma Php Ajax framework, Ajax Components, GUI Builder
May 17, 2012, 12:07:05 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Sigma Php Ajax framework, Ajax Components, GUI Builder
>
Sigma Grid
>
Sigma Grid - Q&A
(Moderators:
steven
,
gbolanoscruz
) >
Create grid with PHP & MYSQL
Pages: [
1
]
« previous
next »
Print
Author
Topic: Create grid with PHP & MYSQL (Read 788 times)
BnK
Newbie
Posts: 1
Create grid with PHP & MYSQL
«
on:
July 20, 2009, 08:03:36 AM »
Hi,
I'm french and i speak just a little English but i need you to success my website.
I try to use Sigma Grid but i would like a dynamic grid (from database SQL)... and i don't find solution for my problem
Have you an idea or a code ?
Thanks all
Logged
steven
Moderator
Hero Member
Posts: 544
Re: Create grid with PHP & MYSQL
«
Reply #1 on:
July 26, 2009, 11:44:16 PM »
<html><head><title>sigma grid creation</title></head>
<body bgcolor=''>
<h2 align=center>Create Sigma Grid Definition Dynamically</h2>
<h4 align=center>Fill Form, Then Press Create Button</h4>
<table align=center>
<form method='POST' name=frmIns action='dynamic_creation.php'>
<tr><td>Host</td><td><input type=text name='host' value='127.0.0.1'></td></tr>
<tr><td>Database</td><td><input type=text name='banco' value='sigma_grid_server'></td></tr>
<tr><td>User Name</td><td><input type=text name='usuario' value='root'></td></tr>
<tr><td>Password</td><td><input type=text name='senha' value='mypass'></td></tr>
<tr><td>Table</td><td><input type=text name='tabela' value='orders'></td></tr>
<tr><td></td><td><input type=submit name='popular' value='Creat Definition'></td></tr>
</form>
</table>
</body>
</html>
<?php
if(isset($_POST['popular'])){
$host=$_POST['host'];
$banco=$_POST['banco'];
$usuario=$_POST['usuario'];
$senha=$_POST['senha'];
$tabela=$_POST['tabela'];
$registros=$_POST['registros'];
$numericos=$_POST['numericos'];
$conexao=mysql_connect($host,$usuario,$senha);
if ($conexao){
$sel=mysql_select_db($banco,$conexao);
if(!$sel) die('select db failed. '.mysql_error());
}else{
die ('connect db failed. '.mysql_error());
}
$str="SELECT * FROM $tabela";
$consulta= mysql_query($str,$conexao);
$nc=mysql_num_fields($consulta);
$nr=mysql_num_rows($consulta);
$dsOption = array();
$cols = array();
for ($j = 0; $j < $nc; $j++) {
$name = mysql_field_name($consulta, $j);
switch (mysql_field_type($consulta, $j)){
case 'int':
$data_def = 'int';
case 'real':
$data_def = 'float';
case 'string':
$data_def = 'string';
case 'date':
$data_def = 'date';
default:
$data_def = 'string';
break;
}
array_push($dsOption, "{name : '" .$name . "' ,type: '". $data_def . "' }");
array_push($cols, "{id: '".$name."' , header: '".$name."'}");
}
print "var dsOption= {\nfields :[<br/>\n";
print join($dsOption, ",<br/>\n");
print "],\n recordType : 'array'};<br/><br/>\n\n";
print "var colsOption = [<br/>\n";
print join($cols, ",<br/>\n");
print "];<br/>\n";
}
?>
Logged
Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News & Announcements
-----------------------------
Sigma Visual GUI Builder & Library
-----------------------------
=> Sigma Visual - Knowledge Share
=> Sigma Visual - Q&A
=> Bug Report & Wishlist
-----------------------------
Sigma Grid
-----------------------------
=> Sigma Grid - Q&A
=> Show Case
=> Bug Report & Wishlist
-----------------------------
Other
-----------------------------
=> AJAX & JavaScript
Loading...