Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Tutorials > PHP Tutorials

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

PHP Tutorials PHP Tutorials

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-30-2006, 09:09 AM
Jaan's Avatar   
Jaan Jaan is offline
<img src="http://forum.codecall.net/images/userbar/mod.png" alt="Mod">
 
Join Date: Dec 2006
Location: Estonia
Age: 17
Posts: 887
Last Blog:
Wadio Media Layout Com...
Credits: 56
Rep Power: 15
Jaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the roughJaan is a jewel in the rough
Send a message via MSN to Jaan
Default Simple MySQL Database Search

Hello

Here i will show how to make a simple searchengine. First we must make a form:

search.html

HTML Code:
<form action="search.php" method="post">
<input type="text" name="find" size="30" /><br />
<input type="submit" value="Search" />
</form>
Now we must make this php part.

search.php

PHP Code:
<?php
// First connect to database
$host "localhost";
$dbuser "username";
$dbpass "password";
$db "database";

$con mysql_connect($host$dbuser$dbpass);
if(!
$con){
die(
mysql_error());
}

$select mysql_select_db($db$con);
if(!
$select){
die(
mysql_error());
}

// Now collect all info into [b]$item[/b] variable

$item $_REQUEST['find'];

// This will take all info from database where row [i]tutorial[/i] is $item and collects it into [b]$data[/b] variable

$data mysql_query("SELECT * FROM tutorials WHERE tutorial LIKE '%$item%'");

// This creates a loop which will repeat itself until there are no more rows to select from the database. We getting the field names and storing them in the $row variable. This makes it easier to echo each field.

while($row mysql_fetch_array($data)){
echo 
$row['date']. "<br>";
echo 
$row['id']. "<br>";
}

?>
__________________


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
| Need help? Send a
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-01-2007, 10:15 AM
xtraze xtraze is offline
Programming God
 
Join Date: Dec 2006
Location: Sri lanka
Posts: 921
Credits: 5
Rep Power: 0
xtraze is on a distinguished road
Send a message via MSN to xtraze Send a message via Skype™ to xtraze
Default

Nice but I use Google custom Search Engine as Google is better than me and I really like Google stuff.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
MYSQL CheatSheet - A must for MySQL Users reachpradeep Database & Database Programming 1 03-03-2007 03:05 PM
Ban IPs with MySQL database Jaan PHP Tutorials 0 01-15-2007 02:13 PM
Shell: MySQL Database Backup Jordan Tutorials 0 08-15-2006 03:18 PM
How do I make a Mysql Database Connection Chan PHP Forum 1 07-17-2006 11:00 AM
MySQL Resources dirkfirst Database & Database Programming 1 05-25-2006 02:31 AM


All times are GMT -5. The time now is 04:54 PM.

Contest Stats

Xav ........ 1276.19
MeTh0Dz|Reb0rn ........ 1047.22
marwex89 ........ 869.98
morefood2001 ........ 868.04
John ........ 857.15
WingedPanther ........ 761.06
Brandon W ........ 684.87
chili5 ........ 294.12
dargueta ........ 192.86
Steve.L ........ 192.06

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 81%

Ads