Re: [PHP-DB] Date question

2006-03-17 Thread Gerry Danen
This works perfect, Bastien!

Many thanks.

Gerry

On 3/13/06, Bastien Koert [EMAIL PROTECTED] wrote:

 select * from table where date_format(date_field, '%Y-%m') = '2006-02'


 bastien


 From: Gerry Danen [EMAIL PROTECTED]
 To: php-db@lists.php.net
 CC: [EMAIL PROTECTED]
 Subject: [PHP-DB] Date question
 Date: Sun, 12 Mar 2006 20:44:13 -0700
 
 While I am rebuilding my crashed laptop (the machine that had all my
 intelligence), I started thinking about a select statement I need.
 
 I have log info in a table and want to extract it on a monthly basis. The
 date field is in -mm-dd format. What's a good way to select those
 dates
 that match 2006-02, for example.
 
 I apologize if the solution should be staring me in the face, but all my
 favorites and help files are toast, until I can restore some of them.



[PHP-DB] Re: Date question

2006-03-13 Thread Gerry Danen
Thanks for all the help, guys. I'm back up, but a lot of my cool tricks are
gone. Gotta get a better backup plan...

Gerry

On 3/12/06, Gerry Danen [EMAIL PROTECTED] wrote:

 While I am rebuilding my crashed laptop (the machine that had all my
 intelligence), I started thinking about a select statement I need.

 I have log info in a table and want to extract it on a monthly basis. The
 date field is in -mm-dd format. What's a good way to select those dates
 that match 2006-02, for example.

 I apologize if the solution should be staring me in the face, but all my
 favorites and help files are toast, until I can restore some of them.

 TIA.

 Gerry




--
Gerry
http://portal.danen.org/


[PHP-DB] Date question

2006-03-12 Thread Gerry Danen
While I am rebuilding my crashed laptop (the machine that had all my
intelligence), I started thinking about a select statement I need.

I have log info in a table and want to extract it on a monthly basis. The
date field is in -mm-dd format. What's a good way to select those dates
that match 2006-02, for example.

I apologize if the solution should be staring me in the face, but all my
favorites and help files are toast, until I can restore some of them.

TIA.

Gerry


Re: [PHP-DB] timestamp value management

2006-01-29 Thread Gerry Danen
I use this function:

functionxlate_datetime($in_field, $in_format)
{
// 2005-10-02 18:05:52
// 0123456789012345678

$year   = substr( $in_field,  0, 4 );
$month  = substr( $in_field,  5, 2 );
$day= substr( $in_field,  8, 2 );
$hour   = substr( $in_field, 11, 2 );
$min= substr( $in_field, 14, 2 );
$sec= substr( $in_field, 17, 2 );
$t  = mktime( $hour, $min, $sec, $month, $day, $year );

if ( $in_field == -00-00 00:00:00 )
return ;
else
return (date($in_format, $t));
}

Gerry



On 1/30/06, xkorakidis [EMAIL PROTECTED] wrote:
 hi guys!
 I'm trying to manage a table containing a timestamp colum
 - when I insert a record, I don't fill a value in timestamp column, so
 current timestamp is inserted. The inserted value is smth like
 20060129213253
 - when I try to show this value in a php page, I use
 date($varOfTimestampColumn) or getdate(). The final result is the
 highest possible date (smth like January 19 2038 I think)

 How can I manage the timestamp field so as to show the correct value?
 Thanks!

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP-DB] first record not displayed

2006-01-23 Thread Gerry Danen
Paul,

Is $link relevant?

Have you run a repair on the table?

The for loop seems odd to me, but I use the while construct exclusively.

Adapted to one of my tables, this worked correctly:

$result = mysql_query(SELECT * FROM photos );
while($row =  mysql_fetch_array($result)){
  echo id={$row[p_id]}  seq={$row[p_desc]} br\n;
}



On 1/23/06, Paul Bern [EMAIL PROTECTED] wrote:
 Hi,

 I have the feeling I'm missing something very obvious here, but it's driving 
 me nuts!   Using this select statement:

 $result = mysql_query(SELECT * FROM latlong  ,$link);
 $nrows = mysql_num_rows($result);


 and either of these to display the results:

 for ($j=0; $rec=mysql_fetch_array($result); $j++){
  print j=$j id={$rec[id]} seq={$rec[seq]}\n;
 }


 while($row =  mysql_fetch_array($result)){
echo id={$row[id]}  seq={$row[seq]} \n;
 }

 The very first record gets dropped/not displayed.  The number of records 
 returned ($nrows) matches what I get from MySQL  and the first record gets 
 displayed (using PHPMyAdmin).  Even if I change the select to pull only 
 certain records, the very first one does not get displayed.

 Can anyone shed any light on this for me?

 Thanks!

 Paul



 
 Paul H. Bern, Ph.D.
 Numeric Data Services Librarian The only thing worse than not
 352 Bird Library   getting what you wanted
 222 Waverly Ave.is getting what you asked 
 for.
 Syracuse, NY 13244
 315-443-1352
 http://library.syr.edu/information/mgi/nds

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP-DB] Table sorting problem

2006-01-12 Thread Gerry Danen
On 1/12/06, Miles Thompson [EMAIL PROTECTED] wrote:

 I'd cheat and add a numeric field, let's call it num_rank, ranking the
 offices in the order you want them displayed, e.g.

 President   10
 Vice-President  20
 .
 .
 .
 Board Member50
 Board Member50
 Board Member50

 and change the query to
  SELECT * from members order by num_rank, last_name
 which would provide officers and board member in the order you want them,
 automatically sorted by name.


This is exactly how I implemented this page:
http://www.arls-lilies.org/h/board.php

--
Gerry
http://portal.danen.org/

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



Re: [PHP-DB] Re: Storing Credit Cards, Passwords, Securely, two-wayencryption

2006-01-08 Thread Gerry Danen
I'm new to this list, so I'm not sure what has been kicked around in this
thread.

I just like to bring up that you need to mention on your page that you can
store their credit card for future convenience and if the user agrees with
that. You also should consider what to do when a credit card has expired. I
had one company add 3 years to my expired card and process a renewal
payment. That is not legal because it is not the information I have
provided... American Express had fun with those turkeys.

FWIW,

Gerry