FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » sqlite and php
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: sqlite and php [message #175884 is a reply to message #175882] Thu, 03 November 2011 22:53 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 11/3/2011 6:49 PM, Tim Streater wrote:
> In article <-76e7-4b70-b81b-67d5b8b8522a(at)q13g2000vbd(dot)googlegroups(dot)com>,
> Anne Achey <anneachey(at)gmail(dot)com> wrote:
>
>> Hi,
>>
>> Anyone know how to create a sqlite database from PHP code? I am trying
>> the code below:
>>
>> try
>> {
>> //create or open the database
>> $database = new SQLiteDatabase('myDatabase.db', 0666, $error);
>> }
>> catch(Exception $e)
>> {
>> die($error);
>> }
>
> What's all this rubbish?
>
> Try:
>
>
> $connstr = "sqlite:" . $name_of_my_db;
> $dbh = new PDO ($connstr);
>
> $dbh->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
>
> and then to use it:
>
> $res = $dbh->query ($sql);
>
> if ($res===false)
> {
> $earray = $dbh->errorInfo ();
> // Then $earray[0] has error code, more info in [1] and [2]
> }
>
> and so on. Have you not looked at the PHP website docs?
>

A completely different interface, Tim. The op's code should work.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: email sent from webpage is classed as junk
Next Topic: session cookie: client side
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 22:49:53 GMT 2024

Total time taken to generate the page: 0.03637 seconds