RE: [PHP] mysql split?

2003-06-27 Thread Jay Blanchard
use explode()

-Original Message-
From: Andrew McCombe [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 27, 2003 11:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP] mysql split?


Hi

I have a field in mysql that has paths to files such as:

project/entertainment/andrew/job/1.jpg
project/corporate/roberts/job/1.jpg
project/corporate/andrew/job/1.jpg
project/identity/john/job/1.jpg

The first level is always 'projects'.  What I want to do is get the
unique
name for the 3rd level for all entertainment, corporate and identity, so
from the data above I would get returned:

andrew
john
roberts

What's the best way to acheive this? I remember seeing something where
you
can split a field in the mysql into parts (ie, split at /)?  or would a
regex be better ('WHERE REGEX
^projects/corporate|entertainment|identity/'
(this doesnt work))?  Hope someone can help.




Regards
Andrew McCombe
Interactive Web Solutions (Stafford)
Tel: 01785 279921





-
The contents of this e-mail and any attachments are confidential and may
be legally privileged. If you have received this e-mail and you are not
a named addressee, please inform us as soon as possible on
+44 (0) 1785 279920  and then delete the e-mail from your system. If you
are
not a named addressee you must not copy, use, disclose, distribute,
print or rely on this e-mail. Any views expressed in this e-mail or any
attachments may not necessarily reflect those of Interactive Web
Solutions'
management.
Although we routinely screen for viruses, addressees should scan this
e-mail and any attachments for viruses. Interactive Web Solutions makes
no
representation or
warranty as to the absence of viruses in this e-mail or any attachments.
Please note that for the protection of our business, we may monitor and
read e-mails sent to and from our server(s).



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql split?

2003-06-27 Thread Andrew McCombe
Does mysql have an explode function?  I suppose this is the wrong place to
ask...

Andrew

- Original Message - 
From: Jay Blanchard [EMAIL PROTECTED]
To: Andrew McCombe [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, June 27, 2003 5:08 PM
Subject: RE: [PHP] mysql split?


 use explode()

 -Original Message-
 From: Andrew McCombe [mailto:[EMAIL PROTECTED]
 Sent: Friday, June 27, 2003 11:06 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] mysql split?


 Hi

 I have a field in mysql that has paths to files such as:

 project/entertainment/andrew/job/1.jpg
 project/corporate/roberts/job/1.jpg
 project/corporate/andrew/job/1.jpg
 project/identity/john/job/1.jpg

 The first level is always 'projects'.  What I want to do is get the
 unique
 name for the 3rd level for all entertainment, corporate and identity, so
 from the data above I would get returned:

 andrew
 john
 roberts

 What's the best way to acheive this? I remember seeing something where
 you
 can split a field in the mysql into parts (ie, split at /)?  or would a
 regex be better ('WHERE REGEX
 ^projects/corporate|entertainment|identity/'
 (this doesnt work))?  Hope someone can help.




 Regards
 Andrew McCombe
 Interactive Web Solutions (Stafford)
 Tel: 01785 279921



 
 
 -
 The contents of this e-mail and any attachments are confidential and may
 be legally privileged. If you have received this e-mail and you are not
 a named addressee, please inform us as soon as possible on
 +44 (0) 1785 279920  and then delete the e-mail from your system. If you
 are
 not a named addressee you must not copy, use, disclose, distribute,
 print or rely on this e-mail. Any views expressed in this e-mail or any
 attachments may not necessarily reflect those of Interactive Web
 Solutions'
 management.
 Although we routinely screen for viruses, addressees should scan this
 e-mail and any attachments for viruses. Interactive Web Solutions makes
 no
 representation or
 warranty as to the absence of viruses in this e-mail or any attachments.
 Please note that for the protection of our business, we may monitor and
 read e-mails sent to and from our server(s).



 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql split?

2003-06-27 Thread Chris Sherwood
Andrew... I think most likely you will have to pull the information into a
php page and parse it.

you then will be able to get accurate results and I dont know if mysql has
an explode function

it doesnt look like it

http://www.mysql.com/doc/en/Function_Index.html

- Original Message -
From: Andrew McCombe [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 27, 2003 9:16 AM
Subject: Re: [PHP] mysql split?


 Does mysql have an explode function?  I suppose this is the wrong place to
 ask...

 Andrew

 - Original Message -
 From: Jay Blanchard [EMAIL PROTECTED]
 To: Andrew McCombe [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Friday, June 27, 2003 5:08 PM
 Subject: RE: [PHP] mysql split?


  use explode()
 
  -Original Message-
  From: Andrew McCombe [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 27, 2003 11:06 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] mysql split?
 
 
  Hi
 
  I have a field in mysql that has paths to files such as:
 
  project/entertainment/andrew/job/1.jpg
  project/corporate/roberts/job/1.jpg
  project/corporate/andrew/job/1.jpg
  project/identity/john/job/1.jpg
 
  The first level is always 'projects'.  What I want to do is get the
  unique
  name for the 3rd level for all entertainment, corporate and identity, so
  from the data above I would get returned:
 
  andrew
  john
  roberts
 
  What's the best way to acheive this? I remember seeing something where
  you
  can split a field in the mysql into parts (ie, split at /)?  or would a
  regex be better ('WHERE REGEX
  ^projects/corporate|entertainment|identity/'
  (this doesnt work))?  Hope someone can help.
 
 
 
 
  Regards
  Andrew McCombe
  Interactive Web Solutions (Stafford)
  Tel: 01785 279921
 
 
 
  
  
  -
  The contents of this e-mail and any attachments are confidential and may
  be legally privileged. If you have received this e-mail and you are not
  a named addressee, please inform us as soon as possible on
  +44 (0) 1785 279920  and then delete the e-mail from your system. If you
  are
  not a named addressee you must not copy, use, disclose, distribute,
  print or rely on this e-mail. Any views expressed in this e-mail or any
  attachments may not necessarily reflect those of Interactive Web
  Solutions'
  management.
  Although we routinely screen for viruses, addressees should scan this
  e-mail and any attachments for viruses. Interactive Web Solutions makes
  no
  representation or
  warranty as to the absence of viruses in this e-mail or any attachments.
  Please note that for the protection of our business, we may monitor and
  read e-mails sent to and from our server(s).
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mysql split?

2003-06-27 Thread Carl Furst
There is a mysql function called substring_index() that returns a substring based on 
an index character like space ' '. You have to specify the string, the index 
character, and how many time it has to find it from the left or right (left being 
positive and right being negative, I think) before the substring is complete.

Check out:

http://www.mysql.com/doc/en/String_functions.html

for that and other string functions that might be useful.

Carl.

-Original Message-
From: Andrew McCombe [mailto:[EMAIL PROTECTED]
Sent: Friday, June 27, 2003 12:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mysql split?

Hi

I have a field in mysql that has paths to files such as:

project/entertainment/andrew/job/1.jpg
project/corporate/roberts/job/1.jpg
project/corporate/andrew/job/1.jpg
project/identity/john/job/1.jpg

The first level is always 'projects'.  What I want to do is get the unique
name for the 3rd level for all entertainment, corporate and identity, so
from the data above I would get returned:

andrew
john
roberts

What's the best way to acheive this? I remember seeing something where you
can split a field in the mysql into parts (ie, split at /)?  or would a
regex be better ('WHERE REGEX ^projects/corporate|entertainment|identity/'
(this doesnt work))?  Hope someone can help.




Regards
Andrew McCombe
Interactive Web Solutions (Stafford)
Tel: 01785 279921




-
The contents of this e-mail and any attachments are confidential and may
be legally privileged. If you have received this e-mail and you are not
a named addressee, please inform us as soon as possible on
+44 (0) 1785 279920  and then delete the e-mail from your system. If you are
not a named addressee you must not copy, use, disclose, distribute,
print or rely on this e-mail. Any views expressed in this e-mail or any
attachments may not necessarily reflect those of Interactive Web Solutions'
management.
Although we routinely screen for viruses, addressees should scan this
e-mail and any attachments for viruses. Interactive Web Solutions makes no
representation or
warranty as to the absence of viruses in this e-mail or any attachments.
Please note that for the protection of our business, we may monitor and
read e-mails sent to and from our server(s).



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php