Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I want to create an online shopping application using HTML. To access the products and its details, I need to access SQLite database. Is it possible to directly access it from HTML?
Posted
Updated 15-Jun-20 0:29am

 
Share this answer
 
Comments
Karen 9664312 6-Feb-13 5:40am    
Yes I tried that. But I'm getting an error "Invalid character constant" for mydb in the below line
var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);
Try this code. It accesses a table called SELLERS from a database auntiesinc.


open('includes/dibs/auntiesinc.db');


}
}

$db = new MyDB();
if(!$db) {
echo $db->lastErrorMsg();
}
else {
echo "Opened database successfully \n" ;
}

$sql =<<<eof
select="" *="" from="" sellers;
eof;

$ret="$db-">query($sql);
while($row=$ret->fetchArray(SQLITE3_ASSOC)){

echo "ID = " . $row['ID'] . "\n";
echo "Seller Name = " . $row['SELLERNAME']. " " . $row['SELLERSNAME'];
}

echo "Operation done successfully\n";
$db->close();

?>
 
Share this answer
 
Comments
Richard Deeming 15-Jun-20 15:42pm    
Your unexplained, unformatted, and incomplete code-dump is completely irrelevant to the question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900