RE: Pattern Matching Problem Solved

2002-01-29 Thread Douglas Brantz

Thanks to everyone for being so helpful with this solution.

Douglas


--
Douglas R. Brantz
Computer Consultant
Fine & Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)


-Original Message-
From: Matthew Walker [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 29, 2002 3:46 PM
To: Douglas Brantz; [EMAIL PROTECTED]
Subject: RE: Pattern Matching Problem

SELECT schdays FROM courses WHERE (schdays LIKE "M") OR (schdays LIKE
"W") OR (schdays LIKE "F")

Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-Original Message-
From: Douglas Brantz [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 29, 2002 1:15 PM
To: [EMAIL PROTECTED]
Subject: Pattern Matching Problem

Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entri
es containing M, W or F.  Is there a way to do this?  

mysql> select schdays from courses where schdays LIKE "%MWF%";
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql> select schdays from courses where schdays LIKE "%M%";
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
"%schdays%"


H
ere is my code from the program:
my $sth2 = $dbh->prepare("select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \"\%$cschdays\%\" AND
done=\"Yes\"etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

Thanks,
Douglas
[EMAIL PROTECTED]

--
Douglas R. Brantz
Computer Consultant
Fine & Applied Arts
Appalachian State University
Boone, NC 28608

82
8-262-6549 (office)
828-262-6312 (fax)




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---
Incoming mail
 is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com
/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

 



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Pattern Matching Solved

2002-01-29 Thread Douglas Brantz

Paul Dubois helped me on this: Check page 520 of his book.

REGEXP "[MWF]"  matches all I need everything inside the [...]
(brackets).

Thank you again Paul.

That problem fixed now moving on to the next one.

Douglas

--
Douglas R. Brantz
Computer Consultant
Fine & Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)


-Original Message-
From: Gurhan Ozen [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 29, 2002 3:24 PM
To: Douglas Brantz; [EMAIL PROTECTED]
Subject: RE: Please Help with Pattern Matching

Doug,
MySql is doing what it is supposed to... If you specify '%MWF%' it will
only
select the values with the string literal 'MWF' in it. If you would like
to
match all the rows that have either M or W or F in it, then use a query
like
:
  select schdays from courses where schdays LIKE "%M%" OR LIKE "%W%" OR
LIKE
"%F%";
  This will return every row that has either M or W or F in the schdays
field.

Gurhan


-Original Message-
From: Douglas Brantz [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 2:59 PM
To: [EMAIL PROTECTED]
Subject: Please Help with Pattern Matching


I have a big problem with pattern matching;
Why does the first example work like this I need to find everything with
MWF in it and I only get the 1 entry?  Is there a way I can make this
work.

mysql> select schdays from courses where schdays LIKE "%MWF%";
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql> select schdays from courses where schdays LIKE "%M%";
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

Thanks in advance,
Douglas

--
Douglas R. Brantz
Computer Consultant
Fine & Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Pattern Matching Problem

2002-01-29 Thread Douglas Brantz

Hello,

I have a big problem! I need to match all patterns in schdays from a
variable schdays and if schdays = mwf it only turns up mwf and not all
entries containing M, W or F.  Is there a way to do this?  

mysql> select schdays from courses where schdays LIKE "%MWF%";
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql> select schdays from courses where schdays LIKE "%M%";
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

I need to be able to say select schdays from courses where schdays LIKE
"%schdays%"


Here is my code from the program:
my $sth2 = $dbh->prepare("select
id,schdays,time_to_sec(timein),time_to_sec(time
out) from courses where schdays LIKE \"\%$cschdays\%\" AND
done=\"Yes\"etc..


So I need to be able to match any pattern with $cschdays.
Do I need to parse out the letters and pattern match each one??  It
should be easier.

Thanks,
Douglas
[EMAIL PROTECTED]

--
Douglas R. Brantz
Computer Consultant
Fine & Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Please Help with Pattern Matching

2002-01-29 Thread Douglas Brantz

I have a big problem with pattern matching;
Why does the first example work like this I need to find everything with
MWF in it and I only get the 1 entry?  Is there a way I can make this
work.

mysql> select schdays from courses where schdays LIKE "%MWF%";
+-+
| schdays |
+-+
| MWF |
+-+
1 row in set (0.00 sec)

mysql> select schdays from courses where schdays LIKE "%M%";
+-+
| schdays |
+-+
| MWF |
| MW  |
| MW  |
| M   |
| M   |
+-+
5 rows in set (0.00 sec)

Thanks in advance,
Douglas

--
Douglas R. Brantz
Computer Consultant
Fine & Applied Arts
Appalachian State University
Boone, NC 28608

828-262-6549 (office)
828-262-6312 (fax)




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Help with formating data in textarea

2002-01-27 Thread Douglas Brantz

Sorry to bother again but does anyone know how to do the following?

I'm interested in learning more about the following:  The only reason I'm writing to
this list is that I've had such great help in the past and I've been looking for new
ways of displaying data from mysql so why not go to the source.

format DATA =
 @  @<<<  @
$sec, $title, $seats
.

$~ = DATA;  # sets current format
write;# write formatted data


I would like to get data out of mysql and then write the format with all data to a
variable and print it out in a textarea.
Below is the code I am currently working with.  I'd like to keep the output in a
textarea so the user can scroll through a formated list.

my @arrinstr=();
my $list="";
while (@arrinstr = $sth4->fetchrow)
{
($sec,$title,$seats)=@arrinstr;
$list.="$sec$title $seats  \n";
}
#print "$list";
print $query->textarea
({-name=>'INFO',-default=>$list,-cols=>'75',-rows=>'5'});
Any help or links to a sourse would be great - Thanks,
Douglas





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail 
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Help with Code

2002-01-27 Thread Douglas Brantz

Hello,

Could someone help me with a bit of code to output data from mysql in a
formated way in a text box.
This might not be the list to ask and if not please direct me in the
right direction.  I'm writing in Perl.
Here is a sample of the code.

my @arrinstr=();
my $list="";
while (@arrinstr = $sth4->fetchrow)
{
($sec,$title,$seats)=@arrinstr;
$csec=$sec;
$ctitle=$title;
$cdes=$seats;
$list.="$csec$ctitle $cdes  \n";
}
#print "$list";
print $query->textarea
({-name=>'INFO',-default=>$list,-cols=>'75',-rows=>'5'});

--

This works but I would like to format the data in the $list.  so that
things are right justified and lined up.

Thanks in advance.

Douglas
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Simple Array Question

2001-07-15 Thread Douglas Brantz

Simple question:
Using multiple checkboxes and assigning the value from mysql field with.

a loop showing all the data I need.  I am created a form to delete
selected users from database. So I loop through all the ids and this is
the checkbox line. not exactly but close.
print ""; in perl

Now I need to grab all the idnums and make an array in my action
perl-cgi script
my @idnums = param("idnum");
my blah = $query->param("blah");
etc..

My question is how do I make the simpliest loop to delete each idnum
from the database.
the way I have it now it only deletes the first selection.

foreach(@idnums){
$theid=$_;
delete from database name where id = $theid
 # does other things sends email to user
}

There must be a better way?  can I find the length of the array with
$length=@idnums;
$theid = 0;
if ($theid < $length) {
delete from database name where id = $idnums($theid)
#send email to user and other stuff
$theid = $theid +1
}
}else{
end



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php