Forum Moderators: coopster
Has anyone implement live search and if so couldl they post the php connect script removing their conenction details but add in stuff like 'DATABASEUSER' 'DATABASEPASSWORD' etc - a really dummies guide I know but I'm a dummy!
<?php
$dhost = 'localhost';
$duser = 'username';
$dpass = 'password';
$dname = 'databasename';
@mysql_connect($dhost, $duser, $dpass) or
die("mySQL service unavailable please try again later");
@mysql_select_db($dname) or
die("Database $dname unreachable, contact an administrator");
?>
Easy stuff,now how does the live search return results from certain fields in certain tables in my database?
SELECT * FROM `articles` WHERE title LIKE '%blah%' OR author LIKE '%blah%'
You will just need to modify the above to work with your specific table/columns. Then use the mysql_query() function to perform the query and mysql_fetch_row() or mysql_fetch_assoc() to read each row and process it.