/    Sign up×
Community /Pin to ProfileBookmark

Nee help for this code

suppose i have 10 products in my database
Example:
iphone 2 – iphone 3g – laptop i3 – laptop i7 – nokia n96 etc

when i enter iphone in my search i see all records stored in database thats my prob!

what i want ?
suppose if i enter laptop i7 or laptop then i get result for laptop i7 or laptop

here is my code..

[CODE]<?php
// Connects to your Database
mysql_connect(“host.com”, “userr”, “pass”) or die(mysql_error());
mysql_select_db(“products”) or die(mysql_error());

$data = mysql_query(“SELECT * FROM Products”)
or die(mysql_error());
Print “<table border cellpadding=3>”;
while($info = mysql_fetch_array( $data ))
{
Print “<tr>”;
Print “<th>Name:</th> <td>”.$info[‘name’] . “</td> “;
Print “<th>new:</th> <td>”.$info[‘new_price’] . “</td> “;
Print “<th>old:</th> <td>”.$info[‘old_proce’] . “</td> “;
Print “<th>faulty:</th> <td>”.$info[‘Faulty_price’] . ” </td></tr>”;
}
Print “</table>”;
?> [/CODE]

if any one have better code then please give me tankxx

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 08.2013 — That's what a WHERE clause is for in your SQL. If you need to support "fuzzy" searches based on whatever text a user enters, you may want to look into using FULLTEXT indexes and their related function in your database and SQL.
×

Success!

Help @spluskhan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...