473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

(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);
}
}
}
?>
Mar 28 '06 #1
0 1126

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bryan J Gudorf | last post by:
We at NeuroKode Labs, LLC, are proud to announce the release of Python Database Objects (PDO) 1.0.1. The current release adds support for PostgreSQL via the pgdb Module. As released previously:...
0
by: Bryan J Gudorf | last post by:
Python Database Objects 1.1.0 has been released. This fairly stable test release includes support for various databases through the mxODBC module. This release also adds more functionality through...
10
by: Bryan J Gudorf | last post by:
PDO, an open source python module for interfacing with RDBMS (SQL databases), has now reached 1.2.0! PDO provides an object oriented API, similar to that of ADO or JDBC, to python developers. PDO...
0
by: Jon Franz | last post by:
----- Original Message ----- From: "Jon Franz" <jfranz@neurokode.com> To: "Serge Orlov" <sombDELETE@pobox.ru> Sent: Wednesday, November 19, 2003 2:39 PM Subject: Re: Python Database Objects (PDO)...
13
by: SectorUnknown | last post by:
I've written a database (Access mdb) front-end using Python/wxpython/and ADO. However, the scope of the project has changed and I need to access the same data on an MSSQL server. Also, the...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
1
by: David Fowler | last post by:
I'm new to getting in touch with other PHP users/PHP team, so please excuse me if this post is at all inappropriate or in the wrong place. In the current release of PHP (5.1.4) and in the CVS for...
4
by: macca | last post by:
Hi, quite new to design patterns so please humour me. I'm having a little trouble figuring out how to use the singleton pattern to create a database PDO object that I can then refer to in my...
9
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.