Creating an AJAX Searchable Database.

Posted by Austin on Stack Overflow See other posts from Stack Overflow or by Austin
Published on 2010-06-03T13:00:13Z Indexed on 2010/06/03 13:04 UTC
Read the original article Hit count: 444

Filed under:
|
|
|
|

Currently I am using MySQLi to parse a CSV file into a Database, that step has been accomplished. However, My next step would be to make this Database searchable and automatically updated via jQuery.ajax().

Some people suggest that I print out the Database in another page and access it externally.

I'm quite new to jquery + ajax so if anyone could point me in the right direction that would be greatly appreciated.

I understand that the documentation on ajax should be enough to tell me what I'm looking for but it appears to talk only about retrieving data from an external file, what about from a mysql database?

The code so far stands:

<head>     
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> 
</head> 
<body> 
<input type="text" id="search" name="search" /> 
<input type="submit" value="submit"> 
<?php 
    show_source(__FILE__); 
    error_reporting(E_ALL);ini_set('display_errors', '1'); 
    $category = NULL; 
    $mc = new Memcache; 
    $mc->addServer('localhost','11211'); 
    $sql = new mysqli('localhost', 'user', 'pword', 'db'); 

    $cache = $mc->get("updated_DB"); 

    $query = 'SELECT cat,name,web,kw FROM infoDB WHERE cat LIKE ? OR name LIKE ? OR web LIKE ? OR kw LIKE ?'; 

    $results = $sql->prepare($query); 
    $results->bind_param('ssss', $query, $query, $query, $query); 
    $results->execute(); 
    $results->store_result();    
?> 

</body> 
</html>

© Stack Overflow or respective owner

Related posts about database

Related posts about AJAX