The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
mysql query all entries which 'dont' match hazno UNIX and Linux Applications 1 04-08-2009 12:47 AM
MySQL Query Analyzer: Interview with Mark Matthews iBot MySQL DevZone RSS 0 11-10-2008 10:50 PM
How to query one to many mysql pinkgladiator High Level Programming 0 10-30-2008 01:45 PM
mysql query browser issue venhart UNIX and Linux Applications 3 09-18-2008 08:05 AM
set mysql password with host parameter ankimo UNIX and Linux Applications 1 09-16-2008 02:50 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-21-2009
hazno hazno is offline
Registered User
  
 

Join Date: Mar 2009
Location: Tokyo
Posts: 21
? parameter in mysql query

I am debugging some code and came across ? in the WHERE cause in a mysql query.

Is this possible and what situations would this be used?

Code:
SELECT ip, count
FROM  table
WHERE domain=?
thanks & regards
  #2 (permalink)  
Old 04-21-2009
amitranjansahu's Avatar
amitranjansahu amitranjansahu is offline
Registered User
  
 

Join Date: Jan 2009
Location: Gurgaon,INDIA
Posts: 239
yOU CAN USE THE FOLLOWING . iS IT WHAT U WANT ?

SELECT IP,COUNT FROM TABLE where DOMAIN LIKE '%%' ;
  #3 (permalink)  
Old 04-21-2009
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
? is a parameter placeholder. That way you don't have to directly compose the SQL with parameters given (failure to escape the parameters properly is the major reason for SQL injection attacks).

Typically, the ? is not valid at the database layer. Normally the database library will dynamically replace them with the parameters (converting where necessary) in the SQL and pass the resulting the query to the database. In other cases, the database engine may accept placeholders itself, especially true if the db supports prepared statements so that an SQL can be prepared once, thus allowing it to be instantiated multiple times to perform the same query with different set of parameters.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 11:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0