Unix Technical Forum

newbie needs help with mysql query from a form submission

This is a discussion on newbie needs help with mysql query from a form submission within the MySQL forums, part of the Database Server Software category; --> Hi guys. I have a simple form which has countries to choose from. Once a country is chosen I ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 09:24 AM
raj
 
Posts: n/a
Default newbie needs help with mysql query from a form submission

Hi guys. I have a simple form which has countries to choose from. Once a
country is chosen I need to do a select lookup. I can't find the correct
symbol for "all" countries in the lookup i.e can someone tell me what I
should palce instead of the ? in the following country to lookup all select
all countries :

SELECT * FROM database WHERE country=?

Thank you in advance,

Raj (newbie)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 09:24 AM
Captain Paralytic
 
Posts: n/a
Default Re: newbie needs help with mysql query from a form submission

On 15 Mar, 13:34, raj <r...@nospam.com> wrote:
> Hi guys. I have a simple form which has countries to choose from. Once a
> country is chosen I need to do a select lookup. I can't find the correct
> symbol for "all" countries in the lookup i.e can someone tell me what I
> should palce instead of the ? in the following country to lookup all select
> all countries :
>
> SELECT * FROM database WHERE country=?
>
> Thank you in advance,
>
> Raj (newbie)



SELECT * FROM database

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 09:24 AM
Peter H. Coffin
 
Posts: n/a
Default Re: newbie needs help with mysql query from a form submission

On Thu, 15 Mar 2007 13:34:05 +0000, raj wrote:
> Hi guys. I have a simple form which has countries to choose from. Once a
> country is chosen I need to do a select lookup. I can't find the correct
> symbol for "all" countries in the lookup i.e can someone tell me what I
> should palce instead of the ? in the following country to lookup all select
> all countries :
>
> SELECT * FROM database WHERE country=?


= comparisons can't do wildcards. LIKE comparisons can.

SELECT * FROM my_table WHERE country LIKE '%';

will pick all.

SELECT * FROM my_table WHERE country LIKE 'NZ';

will pick just rows in New Zealand.

SELECT * FROM my_table WHERE country LIKE '%X';

will pick all the country codes ending in X.

--
23. I will keep a special cache of low-tech weapons and train my troops in
their use. That way--even if the heroes manage to neutralize my power
generator and/or render the standard-issue energy weapons useless--my
troops will not be overrun by a handful of savages armed with spears.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 09:24 AM
Captain Paralytic
 
Posts: n/a
Default Re: newbie needs help with mysql query from a form submission

On 15 Mar, 14:07, "Peter H. Coffin" <hell...@ninehells.com> wrote:
> SELECT * FROM my_table WHERE country LIKE '%';
>
> will pick all.

as will SELECT * FROM my_table

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


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:22 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com