RE: [PHP] substr() in MySQL SELECT?

2001-09-19 Thread Don Read


On 19-Sep-2001 Tom Churm wrote:
 hi,
 
 could someone please tell me why this doesn't work?  i thought that
 string functions could be used in select statements?  i dunno...
 
 SELECT User, SendDate FROM my_form 
 WHERE substr(SendDate, 0, 2)=19;
 
 and i've tried the damn thing with brackets around all different parts.
 

Try to figure out the damn difference between PHP substr()  SQL SUBSTRING().

 thanks much,
 

your welcome,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] substr() in MySQL SELECT?

2001-09-19 Thread Tom Churm

hi, don:

thanks a lot for the tip. and thanks even more for echoing the poor tone
i used in my post--i will try to avoid writing such posts in the future.
after looking at the documentation (many connection problems today), i
was able to write this, like i wanted:

SELECT User, SendDate FROM $table_name 
WHERE (Answer=0)( abs((SUBSTRING(SendDate, 1, 2)) - $NowDay)  7 )

thanks again,

tom

Don Read wrote:
 
 On 19-Sep-2001 Tom Churm wrote:
  hi,
 
  could someone please tell me why this doesn't work?  i thought that
  string functions could be used in select statements?  i dunno...
 
  SELECT User, SendDate FROM my_form
  WHERE substr(SendDate, 0, 2)=19;
 
  and i've tried the damn thing with brackets around all different parts.
 
 
 Try to figure out the damn difference between PHP substr()  SQL SUBSTRING().
 
  thanks much,
 
 
 your welcome,
 --
 Don Read   [EMAIL PROTECTED]
 -- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.

-- 
Tom Churm . Pixelpark AG. . . . . . . . . . . . . . . . . . .
Online Developer E-Marketing
Rotherstrasse 8 . 10245 Berlin . Germany
phone: + 49 30 5058 -1696 . fax: -1756

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]