Jump to content

Newbie89

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by Newbie89

  1. No.need to create the image in PHP using sqlite data.Do you have the simple example to show it?
  2. How to connect sqlite databse to ajax such as display graph?
  3. No.Sorry for my wrong sentence,show/display graph/statistic using ajax.I want to access sqlite database though php first.
  4. Can someone help me?My project need to use it and I'm new to it.Sorry for my grammar mistake.Thanks
  5. and also this: <?php$random = rand(1,3);$dbHandle = new PDO("sqlite:/var/databases/testsite/database.sqlite");$result = $dbHandle->query("SELECT * FROM mybooks WHERE id=$random");$book = $result->fetch(PDO::FETCH_ASSOC);echo "Random peek into my libary:<br><br>$book[title] by $book[author]";?>
  6. Example such like as shown at the bottom: <?php$dbHandle = new PDO("sqlite:/var/databases/testsite/database.sqlite");$dbHandle->exec("CREATE TABLE mybooks (id INTEGER PRIMARY KEY, author NOT NULL, title NOT NULL)");$mybooks = array( "Mass Effect: Revelation" => "Drew Karpyshyn", "Mass Effect: Ascension" => "Drew Karpyshyn", "Dragon Age: The Stolen Throne" => "David Gaider");while (list($title,$author) = each($mybooks)) { $author = $dbHandle->quote($author); $title = $dbHandle->quote($title); $result = $dbHandle->exec("INSERT INTO mybooks (author,title) VALUES ($author,$title)");}?>
  7. Ya, I want pseudo code that describes the C code and SQLite.
  8. Here is the code... 1 #include <stdio.h> 2 #include <sqlite3.h> 3 4 int main(void) { 5 sqlite3 *conn; 6 sqlite3_stmt *res; 7 int error = 0; 8 int rec_count = 0; 9 const char *errMSG; 10 const char *tail; 11 12 error = sqlite3_open("ljdata.sl3", &conn); 13 if (error) { 14 puts("Can not open database"); 15 exit(0); 16 } 17 18 error = sqlite3_exec(conn, 19 "update people set phonenumber=\'5055559999\' where id=3", 20 0, 0, 0); 21 22 error = sqlite3_prepare_v2(conn, 23 "select lastname,firstname,phonenumber,id from people order by id", 24 1000, &res, &tail); 25 26 if (error != SQLITE_OK) { 27 puts("We did not get any data!"); 28 exit(0); 29 } 30 31 puts("=========================="); 32 33 while (sqlite3_step(res) == SQLITE_ROW) { 34 printf("%s|", sqlite3_column_text(res, 0)); 35 printf("%s|", sqlite3_column_text(res, 1)); 36 printf("%s|", sqlite3_column_text(res, 2)); 37 printf("%u\n", sqlite3_column_int(res, 3)); 38 39 rec_count++; 40 } 41 42 puts("=========================="); 43 printf("We received %d records.\n", rec_count); 44 45 sqlite3_finalize(res); 46 47 sqlite3_close(conn); 48 49 return 0; 50 }
  9. Timestamp: 11/17/2012 2:38:24 AMError: syntax errorSource File: file:///C:/Users/Hong/Desktop/hh/ajaxinfo.txtLine: 1, Column: 1Source Code:AJAX is not a new programming language.
  10. I need to put this 2 file add where?I try at http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_first.done!I wanna try in myself by copy them and test.So how?
  11. ajax_info.txt AJAX is not a new programming language. AJAX is a technique for creating fast and dynamic web pages.
  12. <!DOCTYPE html><html><head><script>function loadXMLDoc(){var xmlhttp;if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET","ajax_info.txt",true);xmlhttp.send();}</script></head><body> <div id="myDiv"><h2>Let AJAX change this text</h2></div><button type="button" onclick="loadXMLDoc()">Change Content</button> </body></html>
  13. I got the error when click the textbox of time in order.html.Error show like this... <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL /checksite/serverTime.php was not found on this server.</p><hr><address>Apache/2.2.22 (Ubuntu) Server at localhost Port 80</address></body></html>
  14. order.html <html><body> <script language="javascript" type="text/javascript"><!-- //Browser Support Codefunction ajaxFunction(){var ajaxRequest; // The variable that makes Ajax possible! try{// Opera 8.0+, Firefox, SafariajaxRequest = new XMLHttpRequest();} catch (e){// Internet Explorer Browserstry{ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try{ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){// Something went wrongalert("Your browser broke!");return false;}}}// Create a function that will receive data sent from the serverajaxRequest.onreadystatechange = function(){if(ajaxRequest.readyState == 4){document.myForm.time.value = ajaxRequest.responseText;}}ajaxRequest.open("GET", "serverTime.php", true);ajaxRequest.send(null); } //--></script> <form name='myForm'>Name: <input type='text' onChange="ajaxFunction();" name='username' /> <br />Time: <input type='text' name='time' /></form></body></html>
  15. yes,SQLite was installed.I just dunno how to connect.Such as should the ajax.html and php file need to put in same directory?How to get the SQLite database through AJAX?
  16. May I know the step?I got the code example but I really dunno link them such as put at where or what...Help me plz...
  17. when I type http://localhost/testsite/createdatabase.phpIt show blank page...may I know why?is it the sqlite problem?
×
×
  • Create New...