Re: [PHP] Date problem

2002-12-03 Thread James Coates
At 19:32 03/12/2002 +0800, Jason Wong wrote:


Assuming the column holding the the birthday is called 'birthday':


[snip]

Many thanks!


> * give me actors whose birthdays fall between two dates (ie: Aries)

This one is easy, use the BETWEEN clause in your SELECT statement. Consult
manual for details.


Ignoring the year, obviously, to get my Aries. :-)

James.

--
--
[EMAIL PROTECTED] - http://www.affection.net/~jamesc/ - [+33] 6 79 02 08 99


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




RE: [PHP] Date problem

2002-12-03 Thread James Coates
At 18:44 02/12/2002 -0500, John W. Holmes wrote:


> Can you help me for this ?

Yeah, I already did:


Perhaps you could throw a clue my way, in that case.

I have an actor database (mySQL again) which has actor dates of birth in 
'-MM-DD' format. I want to be able to query against that ignoring the year:

* give me actors who have birthdays in the next five days
* give me actors whose birthdays fall between two dates (ie: Aries)

I've got pretty much everything else working but this one's *really* 
playing with my head. :-( I know I should've employed  a db engineer! :)

James.



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



RE: [PHP] Bizarreness with htmlentities() and other things

2002-11-28 Thread James Coates
At 14:07 28/11/2002 +, Rich Gray wrote:


There is a bug in PHP for the capitalisation problem


Sounds like an internal Microsoft memo.  :-)


http://bugs.php.net/bug.php?id=14655
If you check the link then a workaround was posted by someone.


Cool. If I've got that right, it'll be fine on the production (Linux) 
server, so I have no need to worry. :-)

Many thanks,
James.


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



Re: [PHP] editing .htaccess / .htpasswrd

2002-11-28 Thread James Coates
At 15:46 28/11/2002 +0200, Mika Tuupola wrote:


> into the .htpsswrd file.

Answering to an old mail in here but noticed you didn't get
any replies yet. You should check File_HtAccess and File_Passwd
packages at PEAR:



I quite like class.htpasswd - http://www.hotscripts.com/Detailed/3978.html

James.



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




[PHP] Bizarreness with htmlentities() and other things

2002-11-28 Thread James Coates
Hello!

I'm currently doing some work that requires a mySQL database of actor 
names. For all my actors, I have three columns; first_name, last_name and 
between_name. Because between_name can be written in many ways ("Peter van 
Wibble" or "Fred d'Angelo), and the French have a habit of writing their 
surnames in capitals, I wrote a little function to prepare the actor names 
for output:


 function actor_name($last,$middle,$first) {
 // because we have so many different name combinations, write out a string
 // that does capitalisation and the like properly (hopefully)
 // ex: actor_name("ANGELO","d'","Jean-Pierre") = Jean-Pierre d'Angelo

  // strtolower() everything because ucwords() doesn't work on mixed case
  $last=strtolower($last);
  $middle=strtolower($middle);
  $first=strtolower($first);

  // split hyphenated names so we can ucwords() them
  if (strpos($last,"-")) {
   $lasthyphen=true;
   $last=ereg_replace("-"," ",$last);
  } else { $lasthyphen=false; }

  if (strpos($first,"-")) {
   $firsthyphen=true;
   $first=ereg_replace("-"," ",$first);
  } else { $firsthyphen=false; }

  // if the "middle" name doesn't end with an apostrophe, add a space and
  // lowercase it just in case someone's mis-typed it
  if (!strrpos($middle,"'")) {
   $middle.=" ";
  }

  $last=ucwords($last);
  $first=ucwords($first);

  if ($lasthyphen==true) { $last=ereg_replace(" ","-",$last); }
  if ($firsthyphen==true) { $first=ereg_replace(" ","-",$first); }

 return htmlentities("$first $middle$last");

 }

?>

Thing is, I'm getting bizarre behaviour where some characters become 
modified in a way I don't like - in particular, when the letter L follows 
an E with a diaresis (Raphaƫl, for example) it becomes upper case. 
Suggestions, anyone?

And if anyone wants to make that code shorter and more readable, I'd 
appreciate it greatly. :-)

James.
xx


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