473,327 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Search in Mysql...

Hello...
i have a table which contains a column named "ask" and a column named
"per"...
my think is that i want to search in "ask" and echo the data stored in "per"
for this entry...
How do i do this?
Thanx in advance!
JBK
Aug 11 '06 #1
4 1694
SELECT * FROM table WHERE ask = 'something'

And then echo the per row.

But this is really a very simple question if you know anything about
PHP and MySQL which I gather you don't.

Do a search on Google for "php mysql tutorial" and you ahould find your
answer.

--------------------------

Soren Beck
Costa Tropical Internet
http://www.costatropicalinternet.com

jb*@ewebs.gr wrote:
Hello...
i have a table which contains a column named "ask" and a column named
"per"...
my think is that i want to search in "ask" and echo the data stored in "per"
for this entry...
How do i do this?
Thanx in advance!
JBK
Aug 11 '06 #2
On Fri, 11 Aug 2006 19:09:52 +0300, jbk wrote:
Hello...
i have a table which contains a column named "ask" and a column named
"per"...
my think is that i want to search in "ask" and echo the data stored in "per"
for this entry...
How do i do this?
Thanx in advance!
JBK
select per from tablename where ask = $somevariable;

--
The USA Patriot Act is the most unpatriotic act in American history.
Feingold-Obama '08 - Because the Constitution isn't history,
It's the law.

Aug 11 '06 #3
Thanx...
I am really new to PHP and Mysql...
Anyway, thanx again!
? "Soren" <so*******@gmail.com?????? ??? ??????
news:11**********************@74g2000cwt.googlegro ups.com...
SELECT * FROM table WHERE ask = 'something'

And then echo the per row.

But this is really a very simple question if you know anything about
PHP and MySQL which I gather you don't.

Do a search on Google for "php mysql tutorial" and you ahould find your
answer.

--------------------------

Soren Beck
Costa Tropical Internet
http://www.costatropicalinternet.com

jb*@ewebs.gr wrote:
>Hello...
i have a table which contains a column named "ask" and a column named
"per"...
my think is that i want to search in "ask" and echo the data stored in
"per"
for this entry...
How do i do this?
Thanx in advance!
JBK

Aug 12 '06 #4
Searching in MySQL can be tricky. If you are wanting to search in MySQL
the correct code examles are true:

(1) Search with wildcards (note "s" in wildcard)
SELECT * FROM table WHERE col LIKE '%search%'
-or-
SELECT DISTINCT * FROM table WHERE col LIKE '%search%'

Notice the % (percent sign), this means it will match "search" with
ANYTHING before -OR- after the search term. But if you only want to
search AFTER the term, you would only use the % sign AFTER. Example:
SELECT * FROM table WHERE col LIKE 'search%'

Same for searching BEFORE the search term. Example:
SELECT * FROM table WHERE col LIKE '%search'
-- This will pull anything that starts with * (wildcard) and includes
"search" after it.

Theres also another way to search by using the wildcard (notice: no
"s") search.
It's somewhat like the first explaination, but different.

SELECT * FROM table WHERE col LIKE 'somthing_'
Notice the _ (underscore) -- This means MySQL will get everything from
the term "something" plus anything after "something" -- for example:
"somethings" will be selected as found in the search. The _ is a
wildcard modifier which will tell MySQL how many wildcards it will
search. For example, if you used 3 underscores ___ it will look for the
search term then anything that has up to 3 wildcards. For example:
SELECT * FROM table WHERE col LIKE 'something___'

You can also use it from a starting point. For example:
SELECT * FROM table WHERE col LIKE '___something'
This is basically the samething as 'something___' but it will get up to
3 wildcards BEFORE the search term.

Helpful? If you're confused you can always visit (MySQL 5+)
http://mysql.com/doc/refman/5.0/en/select.html -or- (MySQL 4+)
http://mysql.com/doc/refman/4.1/en/select.html

Hope this helps, -Rob
jb*@ewebs.gr wrote:
Hello...
i have a table which contains a column named "ask" and a column named
"per"...
my think is that i want to search in "ask" and echo the data stored in "per"
for this entry...
How do i do this?
Thanx in advance!
JBK
Aug 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default...
7
by: WindAndWaves | last post by:
Hi Gurus I am keen to make a search page on a website, but I have absolutely zero experience with PHP. I am going to hire an expert, but I thought that it may pay to try it a bit first myself...
5
by: AaronV | last post by:
Hello, I'm a webmaster for a college newspaper and I'm implementing an article search. I'm running PHP with a MySQL database to store the weekly stories. Does anyone know of an article that...
0
by: Extraordinaire | last post by:
Hi I builded a little propert database. I added a search function to the site but have the following problem: I used "SELECT * FROM table1 WHERE area ='province' and type like'%type_1%' and town...
83
by: D. Dante Lorenso | last post by:
Trying to use the 'search' in the docs section of PostgreSQL.org is extremely SLOW. Considering this is a website for a database and databases are supposed to be good for indexing content, I'd...
2
by: misschristalee | last post by:
I'm having a brain blockage day.... Scenario: Search Form with 6 text boxes Query has same six fields Each has this IIF: IIf(IsNull(!!),"",!!) with each dictating the correct text box of...
3
by: hazly | last post by:
I'm very new in the web technology and need advice on search engine. I want to develop a portal using PHP and MySQL on Linux. Need to know on the following features : 1. search engine that could...
1
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was...
8
by: NMarks | last post by:
Hello all, I have created a database for my work that stores information for keys/locks, doors and employees. Specifically the database contains all the information of our lock system, which...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.