Sample of search engine for multiple tables
Searching a string within a table is quite easy, but searching within multiple tables in a database need a little trick. I know it’s not the good one, perhaps everybody who read this can share yours too
Example: We have 3 tables with different content and structures for 3 different pages (News, Articles, Products)
$string = $_POST['what'];
# 1. Search for News and store it into array
$search_news = mysql_query("SELECT * FROM table_news WHERE news_title LIKE '%$string%' OR news_content LIKE '%$string%' ");
while($result=mysql_fetch_array($search_news)){
$array_results[] = array($result['news_title'], "news.php?id=".$result['news_id']);
}
# 2. Search for Articles and store it into array
$search_articles = mysql_query("SELECT * FROM table_articles WHERE articles_title LIKE '%$string%' OR articles_content LIKE '%$string%' ");
while($result=mysql_fetch_array($search_articles)){
$array_results[] = array($result['articles_title'], "articles.php?id=".$result['articles_id']);
}
# 3. Search for products and store it into array
$search_products = mysql_query("SELECT * FROM table_products WHERE products_name LIKE '%$string%' OR products_content LIKE '%$string%' ");
while($result=mysql_fetch_array($search_products)){
$array_results[] = array($result['products_name'], "products.php?id=".$result['products_id']);
}
// all result now is in the array $array_results. index [0] is for Title, and index [1] is for the URL
echo "
- ";
- $search_result[0]
foreach($array_results as $search_result){
echo "
";
}
echo "
";
?>
“Pixel” Image Editor
So far I’m looking for a good image editor for Linux. Yes, there is GIMP, but it’s not so much alike Adobe Photoshop. And need a big change for my brain to get used with it.
Then I found Pixel, an image editor that so much alike Adobe Photoshop. At first glance, it’s very familiar for Photoshop user. I haven’t installed it yet, perhaps tonight. But I hope it’s as easy as Photoshop.
But it’s not a free software, we’ll need to purchase it for US$ 38. So I choose trial version. The limitation is nag screen and watermark on the final result. But I think it’s enough to try how robust this application is. I’ll give the report as soon as I tried this Pixel
Meanwhile, you can download it too: http://www.kanzelsberger.com/pixel/?page_id=4
Does Yahoo’s Forget Password feature work out?
I got a help request from a friend of mine to get back her Yahoo! password that was changed by unknown person. So I asked her any informations she provided when registering Yahoo! account.
I tried using Forget Password feature. I entered all data that Yahoo! need to get back the password. But none the result. So I decided to do an experiment. I create a new Yahoo! account for testing purpose.
I write down on a paper all data I entered when registering new Yahoo! account. Then I tried Forget Password feature and it all end with the same error! See above image, that’s the error message I always get.
Now I have 2 (two) sweet questions for Yahoo!
- Does Yahoo!’s Forget Password feature work perfectly?
- Does the image verification case sensitive or insensitive?
Anybody who read this blog ever succeeded to retrieve back your Yahoo! password?
Don’t Use XML If You Don’t Need XML
XML, or eXtended Markup Language is fairly a new buzzword in web development things. It’s just a simple text file with tags that we can define ourselves. The aim of XML is to create a “simple and re-distributable data”.
But I’ve seen many sites/companies using XML in a wrong way. Well, not so wrong. Just don’t match with XML aims. Many sites using XML as a replacement of common RDBMS. They use XML for storing the data and keep it in their harddrives.
It’s okay if it’s a new system. But spending money rebuilding the system so it can be used with XML just to be “up to date” is a kind of silly things. Just DON’T USE XML if you DON’T REALLY NEED XML.



