PHP Classes

Data base

Recommend this page to a friend!

      Ajax Table Edit  >  All threads  >  Data base  >  (Un) Subscribe thread alerts  
Subject:Data base
Summary:To the same on data bases
Messages:2
Author:sujith
Date:2006-08-12 06:33:34
Update:2009-07-11 18:11:00
 

  1. Data base   Reply   Report abuse  
Picture of sujith sujith - 2006-08-12 06:33:34
i would like to the same on data bases

My schema is given bellow

DROP TABLE IF EXISTS `ezpree`.`fetc`;
CREATE TABLE `ezpree`.`fetc` (
`id` int(10) unsigned NOT NULL auto_increment,
` feedurl` varchar(200) NOT NULL default '',
` feedname` varchar(200) NOT NULL default '',
`storename` varchar(25) NOT NULL default '',
`file_type` varchar(10) NOT NULL default '',
PRIMARY KEY (`id`)
)


What are the changes that i shuld made?
Please help me

  2. Re: Data base   Reply   Report abuse  
Picture of damir damir - 2009-07-11 18:11:00 - In reply to message 1 from sujith
Hi!
I have similar problem, i hope you can help me.
Here is part of modify code of your example AdvATEexample2.php

/*
This is another example...closer to "real world" usage.
I created a small address book type thing, that is updated completely
by ajax. You can add on to this by including links for add/remove...I'm
working on integrating this into the next version.
*/


/////////////////////////////////////////////
CUSTOMIZE: ADD DB CONNECTION
////////////////////////////////////////////
$server = "localhost";
$database = "ajax";
$dbuser = "root";
$password = "";
$db = new mysqli ($server, $dbuser, $password, $database)
or die('Impossibile connettersi al server o al database!');

include("./AdvATE.class.php");
$at = new TableEditor;

extract($_POST);

if ($FormRequest) {
//////////////////////////////CUSTOMIZE
$at->SetForm('id','text');
$at->SetForm('path','text');
$at->SetForm('descrizione','area');
$at->SetForm('posizione','text');
$at->SetForm('pubblicato','radio',array('Si' => 'Si', 'No' => 'No'));

echo $at->HandleFormRequest($_POST['type'], $_POST['old']);

} else if ($FormSave) {

/////////////////////////////////////
CUSTOMIZE: HERE MY SELECT QUERY
//////////////////////////////////////
$data = file_get_contents("./test2.txt"); */
$q_select_ssvirtuale = "select * from chat";
$result = $db->query($q_select_ssvirtuale);
while ($row=$result->fetch_row()) {
$data_ssvirtuale[$i]["id"] = $row[0];
$data_ssvirtuale[$i]["path"] = $row[1];
$data_ssvirtuale[$i]["descrizione"] = $row[2];
$data_ssvirtuale[$i]["posizione"] = $row[3];
$data_ssvirtuale[$i]["pubblicato"] = $row[4];
}
$data = $data_ssvirtuale;
$data = unserialize($data);

$data[$rowid][$colid] = $new;

/*$open = fopen("./test2.txt", 'w');
fwrite($open, serialize($data));
fclose($open);*/
//$q_insert_ssvirtuale = "insert into chat (id, path, descrizione, posizione, pubblicato) values (
//)";

echo $new;

} else {

//the display properties for the odd and even rows
$odd = array('style' => 'background-color: #CCCCCC;');
$even = array('style' => 'background-color: #EEEEEE;');

//the display properties for the overall table
$table = array('align' => 'center', 'cellpadding' => '3', 'cellspacing' => '0', 'width' => '50%');

//table column header information
$headers = array("ID", "PATH", "DESCRIZIONE", "POSIZIONE", "PUBBLICATO");
$headerattrib = array('style' => 'background-color: gray');

$at->SetEvenRowAttribs($even);
$at->SetOddRowAttribs($odd);

$at->SetTableAttribs($table);

$at->SetHeaderAttribs($headerattrib);
$at->SetHeaders($headers);

$at->SetSubmit("AdvATEexample2.php");

$q_select_ssvirtuale = "select * from chat";
$result = $db->query($q_select_ssvirtuale);
while ($row=$result->fetch_row()) {
$data_ssvirtuale[$i]["id"] = $row[0];
$data_ssvirtuale[$i]["path"] = $row[1];
$data_ssvirtuale[$i]["descrizione"] = $row[2];
$data_ssvirtuale[$i]["posizione"] = $row[3];
$data_ssvirtuale[$i]["pubblicato"] = $row[4];
}
$example = $data_ssvirtuale;
//$example = unserialize($example);

/*if (file_exists("./test2.txt")) {
$example = file_get_contents("./test2.txt");
$example = unserialize($example);
} else {
include("example2data.php");
$example = $data;
}*/
/*
for this example, I formated the data similar to how it would come from
a database query...do a print_r on it to see
because of that, we have to do some prep first

*/

$data = array();

foreach ($data as $id => $row) {
$data[$id]['id'] = array('data' => $row['id'], 'input' => 'id');
$data[$id]['path'] = array('data' => $row['path'], 'input' => 'path');
$data[$id]['descrizione'] = array('data' => $row['descrizione'], 'input' => 'descrizione');
$data[$id]['posizione'] = array('data' => $row['posizione'], 'input' => 'posizione');
$data[$id]['pubblicato'] = array('data' => $row['pubblicato'], 'input' => 'pubblicato');
}

$at->SetData($data);

echo $at->GenerateTable();

echo "<pre>";
print_r($data);
echo "</pre>";

}

The output is array null.

thanks and compliment for your class! It's very cool.
by Damir