Current location: Hot Scripts Forums » Programming Languages » PHP » is there command like SET FILTER TO


is there command like SET FILTER TO

Reply
  #1 (permalink)  
Old 09-06-04, 05:20 AM
websmart's Avatar
websmart websmart is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Question is there command like SET FILTER TO

MySQL Query:My records will write UserId in all rows. When retrieving records
is there any command like (as in foxpro/dbase) 'SET FILTER TO
UserId=NNN' so that all commands will be executed only on records
having UserId set NNN only ? or will I have to write like 'Select * from
myTable where amount>5000 and UserId=NNN' in every type of query ?


Thanks for help
__________________
Vyapari Trade Secrets
http://www.vyapari.com/maillist/

Last edited by websmart; 09-06-04 at 05:21 AM. Reason: vb codes
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-06-04, 06:45 AM
Andy1984's Avatar
Andy1984 Andy1984 is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
im fairly new to mysql and still learning but wouldnt this help

PHP Code:



$query 
"SELECT * FROM myTable WHERE UserId like 'NNN%'"
the position of the % means somthing, not quite sure but i think if your userid was tedNNN then the % should be at the start, %NNN

then again i could be totaly wrong
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-06-04, 11:27 AM
infinitylimit's Avatar
infinitylimit infinitylimit is offline
Code Guru
 
Join Date: Jun 2004
Location: Oregon
Posts: 758
Thanks: 0
Thanked 0 Times in 0 Posts
% in sql is a wildcard same with * but they are used differently. Andy is correct in thinking that %bar would return foobar, datebar, candybar while bar% would return barnone, bark, barbque,

% in php is a modulus operator that gives you a remainder

like 5 % 3 = 2 which is like saying 5/3 what is the remainder

anyway my 2c
__________________
Hawk Enterprises -- Home to PHP games, open-source code, tutorials and free downloads
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-07-04, 12:53 PM
websmart's Avatar
websmart websmart is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation I meant bit different

When you include search conditions in EVERY command, it will
work, naturally.

What I meant was, in foxpro/dbase, after you open table and use
'SET FILTER TO CITY="New York"' then you keep on working on
that table and run other commands on that table, only those records
which have city='New York' will be displayed, edited, deleted etc.
In every command you will not be requred to additionally type
FOR CITY='New York' once you have SET filter for that.

For MySQL Table, is similar command exist, which limit subsequent
commands for those type of records only without using record matching
criteria for EACH command.

Hope this makes my question clear.
__________________
Vyapari Trade Secrets
http://www.vyapari.com/maillist/

Last edited by websmart; 09-07-04 at 12:55 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
java set random weight in instance joebloggs2004 Everything Java 1 09-24-04 10:37 AM
filter results cooc PHP 1 08-25-04 06:44 AM
waiting response emergency sercim ASP 0 06-18-04 06:21 PM
looking for web directory with ip filter Dimka Script Requests 0 05-09-04 07:45 PM
Need help with a badword filter list Bradinator The Lounge 0 02-24-04 09:55 PM


All times are GMT -5. The time now is 06:57 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.