Using SQLite3 on 1&1 or elsewhere that does not have it installed [message #178976] |
Wed, 29 August 2012 23:13 |
P E Schoen
Messages: 86 Registered: January 2011
Karma: 0
|
Member |
|
|
This might be better posted on the PHP newsgroup (and in fact I will
crosspost it there), but I thought it might be helpful for anyone else who
may be using SQLite3 instead of the more popular and ubiquitous MySQL, Maybe
I should use it as well, but for now I just want to take the easy route.
Here is the text from my post on the 1&1 forum which you may follow if you
wish
https://forum.1and1.com/index.php?page=Thread&threadID=2756 :
"I just recently finished changing over from Dreamhost to 1&1, and I found
that my PHP scripts would not work. They failed when they encountered
functions for SQLite3, which was installed on Dreamhost, but 1&1 has only
SQLite2, which is incompatible. After some searching and fiddling, I found
that 1&1 does have a PDO module which allows at least some functionality for
SQLite3. Briefly, here are the changes I needed to make: "
//$db = new SQLite3($dbFile); // worked previously with SQLite3 installation
on Dreamhost
$db = new PDO('sqlite:BGFemail.db'); // success
//$result = $sql->fetchArray();
$result = $sql->fetch();
// while ($row = $qres->fetcharray(SQLITE3_BOTH)) {
while ($row = $qres->fetch(SQLITE_BOTH)) {
"The commented code is what did not work, and following each line is code
that does work. "
"I'd like to be able to use my $dbFile variable for the database name but it
did not seem to work with the required sqlite: prefix. I'll try again. Maybe
I used the wrong syntax for concatenation. I use various languages such as
JavaScript and Delphi and C and they are all different. "
Paul
www.muttleydog.com
|
|
|