if(trim($r[1]))
$where .= trim($r[0]) ."='". trim($r[1])."' and ";
}
}
$where = substr($where,0, -4);
$q = "delete from ".$cTable." where ".$where;
//echo $q."<br>";
$rs = ibase_query($host, $q);
}
echo $i.' records was deleted from '.$cTable.'<br>';
}
if(@$_POST['bNew'])
{
if(@$_POST['bNew']=='OK')
{
$new = '';
$ts = '';
$tb = '';
foreach($_POST as $k => $v)
{
if(substr($k, 0, 7)=='__edit_')
{
$k = substr($k, 7);
//echo $k.' = "'.$v.'"<br>';
if($v)
$new .= "'".($v)."',";
else $new .= "".($v).",";
$ts .= "".($k).",";
}
}
$new = substr($new, 0, -1);
$ts = substr($ts, 0, -1);
$i=0;
$q = "insert into ".$cTable." (".$ts.") values(".$new.")";
echo $q;
$rs = ibase_query($host, $q);
$i++;
echo "<br>";
echo 'Updated..';
}
elseif(@$_POST['bNew']=='Cancel')
{
}
else
{
echo '<form action="" method="post">';
echo '<table>';
$rs = ibase_query($host, "SELECT * FROM ".$cTable);
$coln = ibase_num_fields($rs);
for ($i = 0; $i < $coln; $i++) {
$col_info = ibase_field_info($rs, $i);
$fields[] = $col_info['name'];
}
$val='';
foreach($fields as $row)
{
if($row)
{
echo '<tr><td>'.($row).'</td><td><input type="text" name="__edit_'.($row).'" value=""></td></tr>';
}
}
echo '</table><br>';
echo '<input type="hidden" name="cTable" value="'.$cTable.'">';
?>
<input type="submit" name="bNew" value="OK">
<input type="submit" name="bNew" value="Cancel">
<br>
<?
echo '</form>';
die();
}
}
listTablesSel();
?>
<form action="" method="post">
<?
echo '<input type="hidden" name="cTable" value="'.$cTable.'">';
?>
<input type="submit" name="bEdit" value="Edit">
<input type="submit" name="bDel" value="Delete">
<input type="submit" name="bNew" value="New">
<br>
<br>
<?
$rs = ibase_query($host, "SELECT * FROM ".$cTable);
$coln = ibase_num_fields($rs);
echo "<table>";
echo "<tr>";
for ($i = 0; $i < $coln; $i++) {
$col_info = ibase_field_info($rs, $i);
$fields[] = $col_info['name'];
echo "<td> ".$col_info['name']." </td>";
/*echo "name: ". $col_info['name']. "<br>";
echo "alias: ". $col_info['alias']. "<br>";
echo "relation: ". $col_info['relation']. "<br>";
echo "length: ". $col_info['length']. "<br>";
echo "type: ". $col_info['type']. "<br>";
echo "******************<br>";*/
}
echo '<td></td>';
echo "</tr>";
$col1 = $col = "#00ff00";
$col2 = "#0000ff";
$c=0;
while ($row = ibase_fetch_object($rs)) {
if($col == $col1) $col = $col2; else $col = $col1;
echo '<tr>';
$val = '';
foreach($fields as $field)
{
echo '<td>'. $row->$field .'</td>';
$val .= ($field).'='.($row->$field).':::';
}
echo '<td> <input type="checkbox" name="rows[]" value="'.urlencode($val).'"></td>';
echo "</tr>";
$c++;
}
echo "</table>";
echo "</form>";
echo '<a href="">Refresh</a> <a href="index.php">Main</a>';
die();
function q($q)
{
global $host;
return ibase_query($host,$q);
}
?>
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.