(PDO) database entries are not possible, even without errorfeedback!

This is a discussion on (PDO) database entries are not possible, even without errorfeedback! within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi! I am trying to insert with PDO-Sqlite rows through a form. I can do whatever I want, I ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-28-2006
Tamer Higazi
 
Posts: n/a
Default (PDO) database entries are not possible, even without errorfeedback!

Hi!
I am trying to insert with PDO-Sqlite rows through a form. I can do
whatever I want, I don't find the sollution where I made the error.
Perhaps somebody of you could help me?!

However, the database is created with sqlite, and the entries should be
done with PDO_SQLITE. However, no entries are done anyways and I am one
step going nuts, specially because I don't receive no warning or
errormessage on the screen.

For any help, I would thank you very much.

Tamer


Code:

<?php
require_once('HTML/Form.php');
require_once('I18N/UnicodeString.php');
require_once('HTML/Table.php');

class Formular
{
private $ServerVar = array("Auswahl","Betreff","Eingabe");


function __construct()
{

$this->ServerVar["Auswahl"] = $_GET['Auswahl'];
$this->ServerVar["Betreff"] = $_GET['Feld'];
$this->ServerVar["Eingabe"] = $_GET['Eingabe'];
$this->MeinFormular();


//$this->sqdb();
if(($this->ServerVar["Betreff"] === null) or
($this->ServerVar["Eingabe"] === null))
{
$this->MeineDB();
$this->TextFeld();
}
elseif (($this->ServerVar["Betreff"] === "") or
($this->ServerVar["Eingabe"] === ""))
{
$this->MeineDB();
$this->TextFeld();
}

else
{
$Auswahl = $this->ServerVar["Auswahl"];
$Betreff = $this->ServerVar["Betreff"];
$Eingabe = $this->ServerVar["Eingabe"];
$this->MeineDB2($Auswahl,$Betreff,$Eingabe);
$this->TextFeld();
}



}


private function MeineDB()
{

try
{
$dbh = new
PDO('sqlite2:/home/tamer/public_html/citybaker/WebContent/mysqlitedb');
$sql = 'select * from Daten';

foreach ($dbh->query($sql) as $row)
{
//print_r($row);
}
$this->ServerVar = $row;
$dbh = null;


}


catch (PDOException $e)
{
die("Can't connect!");
}


}

private function Datei()
{
$Eigen =
fileowner('/home/tamer/public_html/citybaker/WebContent/formular.sq2');

print(fileperms('/home/tamer/public_html/citybaker/WebContent/formular.sq2'));
//print($Eigen);
}

private function MeineDB2($selection,$subj,$input)
{
switch ($selection)
{

case 0:
$selection = 'Deutsch';
break;

case 1:
$selection = 'Englisch';
break;
case 2:
$selection = "Arabisch";
break;
}

$DBWerte = 'insert into Daten
values('.'"'.$selection.'","'.$subj.',"'.$input.') ';
//print($DBWerte);
try
{
$dbh = new
PDO('sqlite2:/home/tamer/public_html/citybaker/WebContent/mysqlitedb');
//$dbh->beginTransaction();
$dbh->exec($DBWerte);
//$dbh->commit();
$dbh = null;
$this->ServerVar = $row;

}


catch (PDOException $e)
{

//$dbh->rollBack();
echo "Failed: ".$e->getMessage();
}

}

private function MeinFormular()
{
$Sprachen = array('deutsch','englisch','arabisch');
$Formular = new
HTML_Form("Formular.php",'get','Meinformular',''," text/plain","accept-charset=utf-8");
$Formular->addSelect("Auswahl","Auswahl",$Sprachen);
$Formular->addText("Feld","Betreff",null,50,50);
$Formular->addTextarea("Eingabe","Eingabefeld",null,50,10,10 );
$Formular->addSubmit('submit','absenden!');
$Formular->display();
}

private function TextFeld()
{
$TabelleAttribute = array("border"=>"1");
$Tabelle = new HTML_Table($TabelleAttribute,0,false);
$Tabelle->addCol($this->MeinArrayText);
print($Tabelle->toHtml());
}

private function sqdb()
{
if ($db = sqlite_open('mysqlitedb', 0666, $sqliteerror))
{
sqlite_query($db, 'CREATE TABLE Daten (sprache varchar(100),betreff
varchar(100),feld varchar(1000))');
//sqlite_query($db, "INSERT INTO foo VALUES ('fnord')");
//$result = sqlite_query($db, 'select bar from foo');
//var_dump(sqlite_fetch_array($result));
} else {
die($sqliteerror);
}
}
}


?>
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:15 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0