SQLitedatabase

Problems with the Windows version of XAMPP, questions, comments, and anything related.

SQLitedatabase

Postby Ghafoer86 » 24. November 2014 18:25

i want to create database with SQLite. there is my code :
Code: Select all
<?php
try
{
  //create or open the database
  $database = new SQLiteDatabase('myDatabase.sqlite', 0666, $error);
}
catch(Exception $e)
{
  die($error);
}

//add Movie table to database
$query = 'CREATE TABLE Movies ' .
         '(Title TEXT, Director TEXT, Year INTEGER)';

if(!$database->queryExec($query, $error))
{
  die($error);
}

//insert data into database
$query =
  'INSERT INTO Movies (Title, Director, Year) ' .
  'VALUES ("The Dark Knight", "Christopher Nolan", 2008); ' .

  'INSERT INTO Movies (Title, Director, Year) ' .
  'VALUES ("Cloverfield", "Matt Reeves", 2008); ' .

  'INSERT INTO Movies (Title, Director, YEAR) ' .
  'VALUES ("Beverly Hills Chihuahua", "Raja Gosnell", 2008)';

if(!$database->queryExec($query, $error))
{
  die($error);
}

//read data from database
$query = "SELECT * FROM Movies";
if($result = $database->query($query, SQLITE_BOTH, $error))
{
  while($row = $result->fetch())
  {
    print("Title: {$row['Title']} <br />" .
          "Director: {$row['Director']} <br />".
          "Year: {$row['Year']} <br /><br />");
  }
}
else
{
  die($error);
}
?>


this code i save with tes.php on folder C:\xampp\htdocs\xampp but after i run this file on my browser i have error message :
Fatal error: Class 'SQLiteDatabase' not found in C:\xampp\htdocs\xampp\tes.php on line 6
anybody can helpme about this error :cry: :cry: :cry:
Never Stop Learning. Make Different's Style. Leading The Innovation.
User avatar
Ghafoer86
 
Posts: 20
Joined: 12. August 2013 17:39
Location: Indonesia - southeast ASIA (City : Palu Province : Central Sulawesi)
XAMPP version: 1.8.3-2
Operating System: Android Marshmallow

Re: SQLitedatabase

Postby Altrea » 24. November 2014 19:04

We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8286
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: SQLitedatabase

Postby Ghafoer86 » 24. November 2014 19:07

I'm Sorry, this is just about code. after i learned the phonebook.php i understand how to CRUD the SQLite3. so this problem can be solved. thank you :D :mrgreen: :P
Never Stop Learning. Make Different's Style. Leading The Innovation.
User avatar
Ghafoer86
 
Posts: 20
Joined: 12. August 2013 17:39
Location: Indonesia - southeast ASIA (City : Palu Province : Central Sulawesi)
XAMPP version: 1.8.3-2
Operating System: Android Marshmallow


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 34 guests