Jump to content

sqlite help


sasori

Recommended Posts

the error says

 

Warning: sqlite_query() [function.sqlite-query]: no such table: Product in C:\wamp\www\test2\index2.php on line 76

can't connect

 

when there is a Product table existing in my testdb database

kindly help me configure what's going on with that error please?

here's my code

<?php

$db = sqlite_open("testdb");
$sql = "SELECT * FROM Product";
$result = sqlite_query($db,$sql) or die ("can't connect");
$row = sqlite_fetch_array($resut);

while($row = sqlite_fetch_array($result))
{
foreach($row as $value)
{
	echo "$value<br/>";
}
}
sqlite_close($db);




?>

Link to comment
Share on other sites

Try replacing this:

$db = sqlite_open("testdb");

 

With this:

$db = sqlite_open("testdb", 0666, $error);
echo $error."<br />";

 

I've never use SQLite before so I'm just looking at the manual.

 

same error..it just added a space above the error message because of the <br> tag :(

Link to comment
Share on other sites

the error says

 

Warning: sqlite_query() [function.sqlite-query]: no such table: Product in C:\wamp\www\test2\index2.php on line 76

can't connect

 

when there is a Product table existing in my testdb database

kindly help me configure what's going on with that error please?

How did you create the table? Make sure your have spelt product correctly.

Link to comment
Share on other sites

How did you create the table? Make sure your have spelt product correctly.

 

first i made the testdb using this code

$db = sqlite_open(testdb);
it generates itself because the file doesn't exist

then i made the table Product and the 2 fields named Firstname, Lastname using the sqlite manager

 

Link to comment
Share on other sites

When using SQLite in PHP make sure the library versions match between sqlite manager and PHP.

 

The Sqlite library built-in to PHP is version 2.8.x (veryfy this by running phpinfo and looking for the SQLite subsection). If sqlite manager is using a newer version of the library, then PHP wont be able to read the database file correctly

Link to comment
Share on other sites

Depends, I use sqlite more often than mysql these days. For small to medium sites its quicker, easier to setup and easier to maintain.

 

am confuse, how could that be? since most "free" webhosting services for PHP doesn't have sqlite on the cpanel :( , i can only see this stuff in my wamp server in localhost as it is a built-in.

Link to comment
Share on other sites

I believe on windows installations you have to enable the sqlite extension within the php.ini, its not enabled by default

 

However on a *nix (most hosts run linux rather than windows) installations sqlite is available if PHP was complied with the --with-sqlite flag, no need to enable sqlite within php.ini

 

To see if sqlite is available run phpinfo() and look for an sqlite sub heading.

Link to comment
Share on other sites

I believe on windows installations you have to enable the sqlite extension within the php.ini, its not enabled by default

 

However on a *nix (most hosts run linux rather than windows) installations sqlite is available if PHP was complied with the --with-sqlite flag, no need to enable sqlite within php.ini

 

To see if sqlite is available run phpinfo() and look for an sqlite sub heading.

 

cool now i can see that sqlite is enabled on my free hosting account.."but", how am i gonna see the "sqlite manager" ?

Link to comment
Share on other sites

By sqlite manager do you mean the firefox addon or some program installed on your computer? Not sure what you mean.

 

just like what i've said before, sqlite manager is built-in with my wamp on localhost..but on a live free hosting account cpanel, i don't see any sqlite manager, that's what am asking, on how will you be able to see the sqlite manager on a live free hosting account?

Link to comment
Share on other sites

As the database is only single file, I'd just download the .sqll database file to my computer annd open it into sqlite manager to apply whatever changes needs to be done. Once finished I'd reupload the database overwriting the old one.

 

oh ok..so this means, there is no sqlite manager on live free hosting cpanel accounts at all?

Link to comment
Share on other sites

You'll have to ask your host whether they provide such a facility for managing sqlite databases online, as you're using a free host then I doubt it. To mange an sqlite database online then the application will need to be web base (ie like phpMyAdmin for managing MySQL databases).

Link to comment
Share on other sites

You'll have to ask your host whether they provide such a facility for managing sqlite databases online, as you're using a free host then I doubt it. To mange an sqlite database online then the application will need to be web base (ie like phpMyAdmin for managing MySQL databases).

 

oh ok..am not going to close this topic yet.. ill get back to this sqlite thingy.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.