[PHP-DB] php and local printing

2003-03-03 Thread Rajesh Fowkar
Hello,

What is the best way to print on a locally connected printer from php ?

For printing we want to give the user three options :

1. Screen

2. Local Printer

3. Server Printer

What you guys are using for printing on locally connected printer from
php.

Thanks in advance.

Peace

--
Rajesh
:
[ GNU/Linux One Stanza Tip (LOST) ]###

Sub : kill-proc (killing user process by an user)LOST #285

#!/bin/sh
ps -aef | grep $USER
echo -en Process-No to kill : ; read P_ID
kill $P_ID
 
[EMAIL PROTECTED]
:

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



[PHP-DB] Help with a query

2003-03-03 Thread Jonathan Villa

I can't figure this query out.

I want to pull data from 2 tables but using a primary key from one.

Here is what I think it should look like.

SELECT item_id, subtotal, quantity from shopping_cart WHERE order_id =
(SELECT order_id FROM orders WHERE session_id = session_id()) AND
customer_id = $customer_id;

-Jonathan




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



[PHP-DB] Help with MySQL Logic

2003-03-03 Thread Rankin, Randy
Hello All,

This may be a bit off topic. If so, my apololgies. 

A client of mine, a rail car storage company, has asked that I create a
PHP/MySQL application in which they will maintain and track rail cars. I am
having a bit of trouble however working through one of thier requirements.
They need to know in what position the rail car is on each track. For
example, they might have a track called X which will hold 30 rail cars. They
would enter the car information for 30 cars and associate each of them with
track X. If one of the car owners decides to move car 3 out of storage, then
the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain and
car 4-30 would become car 3-29 ). In the same manner, I need to be able to
add a car to the track once an empty slot is available. For example, If the
new car goes at the front of the track then it would become car 1 and the
remaining cars, originally numbered 1-29 would become 2-30. 

I hope I explained thourougly. Any suggestions would be appreciated. 

Randy


[PHP-DB] Interbase and PHP locking (was: Interbase locking)

2003-03-03 Thread Koleszr Tibor
Hello everybody,

Some days ago I've posted a question about interbase locking. I've solved
the problem after searching at interbase developers network and php manuals.
Let me drop some line about my experiences...

Deadlock is when two (or more) transactions want update or delete a field
in the same table at the same time.
For cause a deadlock in Interbase do the following:

   $tr_id1 = ibase_trans();
   $tr_id2 = ibase_trans();

   $result = ibase_query($tr_id1, UPDATE TEST SET FIELD_A=FIELD_C);
   echo First result: $resultbr;
   ibase_commit($tr_id1);

   $result = ibase_query($tr_id2, UPDATE TEST SET FIELD_A=FIELD_C);
   echo Second result: $resultbr;

If you run this you can see that the second result will be false and you'll
get
an error about interbase deadlock. Thats all right about interbase his do
its best when doing this. This error must be handled by the application.

So simple complete the code above with some check and rollback, like this:

   $tr_id1 = ibase_trans();
   $tr_id2 = ibase_trans();

   $result = ibase_query($tr_id1, UPDATE TEST SET FIELD_A=FIELD_C);
   echo First result: $resultbr;
   ibase_commit($tr_id1);

   $result = 0;

   while (!$result) {
 $result = ibase_query($tr_id2, UPDATE TEST SET FIELD_A=FIELD_C);
 echo Second result: $resultbr;
 if (!$result) {
   ibase_rollback($tr_id2);
   $tr_id2 = ibase_trans();
 }
   }


   ibase_commit($tr_id2);

This will works nicely, and you will see that the first query will fail but
the second
query (in another one transaction!) will be correct. The complete solution
is when you
write a function for the queries to runs in a transaction and its check.

Regards,


Tibor


--
Integranet Internet Service Provider Co. - www.integranet.hu
GnuPG fingerprint: 189C B343 71A8 C25F 7456  F46F D522 C34C ED7F A574
Koleszr Tibor, Director and Senior System Engineer, Debian Developer
[EMAIL PROTECTED], [EMAIL PROTECTED], http://www.oldw.net



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



RE: [PHP-DB] Help with a query

2003-03-03 Thread Jonathan Villa
2) Have you tried echoing the query to see exactly what is being passed
to
the RDBMS?  That is, perhaps session_id() or $customer_id is not giving
a
valid value.

Yes the values are all their.

I am using MySQL so I guess I will have to go a different route.

I'll have to run 2 queries which is what I wanted to avoid, but I guess
there's no other way

Thanks for the quick reply.  
 
--- Jonathan
 
 
 
-Original Message-
From: Paul Burney [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 03, 2003 10:06 AM
To: [EMAIL PROTECTED]; PHP Database List
Subject: Re: [PHP-DB] Help with a query

on 3/31/03 10:41 AM, Jonathan Villa at [EMAIL PROTECTED] appended
the
following bits to my mbox:

 I want to pull data from 2 tables but using a primary key from one.
 
 Here is what I think it should look like.
 
 SELECT item_id, subtotal, quantity from shopping_cart WHERE order_id =
 (SELECT order_id FROM orders WHERE session_id = session_id()) AND
 customer_id = $customer_id;

A few questions:

1) Are you sure your RDBMS supports sub-queries?  Most do, but MySQL
does
not.

2) Have you tried echoing the query to see exactly what is being passed
to
the RDBMS?  That is, perhaps session_id() or $customer_id is not giving
a
valid value.

3) Using the results of (2) above, have you input the query into another
RDBMS client (i.e., command line version) to see what kind of errors are
given.

HTH.

Sincerely,

Paul Burney
http://paulburney.com/

?php
while ($self != asleep) {
$sheep_count++;
}
?




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



Re: [PHP-DB] Help with MySQL Logic

2003-03-03 Thread Adam Voigt




Heh. Sounds like a programming class homework project.

I would say through the clever use of where clauses's, like:



UPDATE position SET posistion = (position-1) WHERE position  $idremoved;



Would work, assuming $idremoved containted the position of the car removed.



On Mon, 2003-03-03 at 10:59, Rankin, Randy wrote:

Hello All,



This may be a bit off topic. If so, my apololgies. 



A client of mine, a rail car storage company, has asked that I create a

PHP/MySQL application in which they will maintain and track rail cars. I am

having a bit of trouble however working through one of thier requirements.

They need to know in what position the rail car is on each track. For

example, they might have a track called X which will hold 30 rail cars. They

would enter the car information for 30 cars and associate each of them with

track X. If one of the car owners decides to move car 3 out of storage, then

the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain and

car 4-30 would become car 3-29 ). In the same manner, I need to be able to

add a car to the track once an empty slot is available. For example, If the

new car goes at the front of the track then it would become car 1 and the

remaining cars, originally numbered 1-29 would become 2-30. 



I hope I explained thourougly. Any suggestions would be appreciated. 



Randy




-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Help with MySQL Logic

2003-03-03 Thread 1LT John W. Holmes
 A client of mine, a rail car storage company, has asked that I create a
 PHP/MySQL application in which they will maintain and track rail cars. I
am
 having a bit of trouble however working through one of thier requirements.
 They need to know in what position the rail car is on each track. For
 example, they might have a track called X which will hold 30 rail cars.
They
 would enter the car information for 30 cars and associate each of them
with
 track X. If one of the car owners decides to move car 3 out of storage,
then
 the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain
and
 car 4-30 would become car 3-29 ). In the same manner, I need to be able to
 add a car to the track once an empty slot is available. For example, If
the
 new car goes at the front of the track then it would become car 1 and the
 remaining cars, originally numbered 1-29 would become 2-30.

Not sure if this helps or if you already realize this...

Say you have a table that identifies the track_id and car_id. Now, you
delete the car_id for car #3, like you've said. So, that row is deleted and
you've got a hole now. You can run a query such as:

UPDATE table SET car_id = car_id - 1 WHERE car_id BETWEEN 4 AND 30 AND
track_id = XX

to adjust all of the other car_id numbers.

Now, say you want to add a new car to the beginning.

UPDATE table SET car_id = car_id + 1 WHERE track_id = XX

and then insert your new car at position #1.

Throw in some checks to make sure you don't go over 30 cars and you should
have it. You can get a count of how many cars are on a certain track with:

SELECT COUNT(*) AS c FROM table WHERE track_id = XX

Hope that helps. It sounds like a fun project.

---John Holmes...


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



Re: [PHP-DB] Help with MySQL Logic

2003-03-03 Thread bbonkosk
What about two tables, one would have this:
carID
carCompany
carPayload
etc...

the second this:
position
carID

This table would be static and if a car was not present in certain conditions 
they would contain (-1) for the carID.  Then finding an empty slot to place an 
incoming car should be doable (stepping through to find (-1), and when a car is 
removed from a slot, then you could update the list, just dump out 
the 'current' order into an array, and then you would be able to sort, order, 
etc...

Hope this makes sense.
-Brad

 Heh. Sounds like a programming class homework project.
 I would say through the clever use of where clauses's, like:
 
 UPDATE position SET posistion = (position-1) WHERE position 
 $idremoved;
 
 Would work, assuming $idremoved containted the position of the car
 removed.
 
 On Mon, 2003-03-03 at 10:59, Rankin, Randy wrote:
 
 Hello All,
 
 This may be a bit off topic. If so, my apololgies. 
 
 A client of mine, a rail car storage company, has asked that I
 create a
 PHP/MySQL application in which they will maintain and track rail
 cars. I am
 having a bit of trouble however working through one of thier
 requirements.
 They need to know in what position the rail car is on each track.
 For
 example, they might have a track called X which will hold 30 rail
 cars. They
 would enter the car information for 30 cars and associate each of
 them with
 track X. If one of the car owners decides to move car 3 out of
 storage, then
 the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would
 remain and
 car 4-30 would become car 3-29 ). In the same manner, I need to be
 able to
 add a car to the track once an empty slot is available. For example,
 If the
 new car goes at the front of the track then it would become car 1
 and the
 remaining cars, originally numbered 1-29 would become 2-30. 
 
 I hope I explained thourougly. Any suggestions would be appreciated.
 
 Randy
 
 -- 
 Adam Voigt ([EMAIL PROTECTED])
 The Cryptocomm Group
 My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
 






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



RE: [PHP-DB] Help with MySQL Logic

2003-03-03 Thread Hutchins, Richard
Coming from a non-programmer...
 
If you were to take the cars' IDs and put them in an array named for the
track a specific group of cars is on, that would give you indexes, thus
positions, from 0-N depending on how many cars are there. Any time you have
to add or delete cars, you should be able to delete or add the ID from or to
the array and the indexing would automatically tell you what position all of
the cars are in. You should be able to move cars (IDs) around in the array
with PHP too.
 
So you'd have:
 
$track1 = array(2,4,6,8); //where 2,4,6,8 are the IDs of rail cars
 
And you'd use the serialize and unserialize functions to get the data into
and out of MySQL and PHP to manipulate the order of the IDs inside the
array.
 
Like I said, I'm a non-programmer, but a track with cars on it sounds pretty
similar to a real-world representation of an array structure to me. I'm sure
there will be myriad other ways to get at this problem with their own good
and bad points.
 
I agree with John though, sounds like a fun project.
 
Rich

-Original Message-
From: Adam Voigt [mailto:[EMAIL PROTECTED]
Sent: Monday, March 03, 2003 11:25 AM
To: Rankin, Randy
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Help with MySQL Logic


Heh. Sounds like a programming class homework project. 
I would say through the clever use of where clauses's, like: 

UPDATE position SET posistion = (position-1) WHERE position  $idremoved; 

Would work, assuming $idremoved containted the position of the car removed. 

On Mon, 2003-03-03 at 10:59, Rankin, Randy wrote: 

Hello All, 

This may be a bit off topic. If so, my apololgies. 

A client of mine, a rail car storage company, has asked that I create a 
PHP/MySQL application in which they will maintain and track rail cars. I am 
having a bit of trouble however working through one of thier requirements. 
They need to know in what position the rail car is on each track. For 
example, they might have a track called X which will hold 30 rail cars. They

would enter the car information for 30 cars and associate each of them with 
track X. If one of the car owners decides to move car 3 out of storage, then

the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain and

car 4-30 would become car 3-29 ). In the same manner, I need to be able to 
add a car to the track once an empty slot is available. For example, If the 
new car goes at the front of the track then it would become car 1 and the 
remaining cars, originally numbered 1-29 would become 2-30. 

I hope I explained thourougly. Any suggestions would be appreciated. 

Randy 


-- 

Adam Voigt ([EMAIL PROTECTED])

The Cryptocomm Group

My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



[PHP-DB] Mapping objects to tables: the actual database object

2003-03-03 Thread Alexander Deruwe
Hey everyone,

I'm investigating using PHP's OOP functionality instead of the
traditional model to implement a project.  I've been looking at
information about mapping objects to tables, and have mostly found what
I needed, but am left with a question I would like to ask here.  If this
is the wrong list for this type of question, please be so kind to
redirect me somewhere else, and please cc me on replies as I do not
subscribe to this list.

When mapping objects to tables, how would one usually handle the actual
database object?  Suppose we have a class Database derived from
PostgresDatabase which implements database functionality (query(),
dataQuery(), numRows(), ...) and then some actual classes:

 SomeClass
 |
 |
SomeSubClass

And SomeSubClass has a MemberClass attribute.  All of these classes need
access to the database to do their work.

SomeClass could just have a Database attribute through which database
operations are conducted, and so SubClass would have it too.  The
trickier part (or maybe I am just thick) seems to be MemberClass.  How
would this class best perform it's database operations?
There are at least two possibilities:

1. Pass MemberClass a Database object when constructing it

The problem with this is that in code that creates just a MemberClass
object there might not be a Database class available.  This could be
eliminated with a factory class perhaps.

2. Make all classes that need database access derive from BaseClass and
   let that class set up access

Has anyone else been down this road?  I'd appreciate feedback on this
issue.

Thanks!

-- 
Alexander Deruwe
AQS-CarControl

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



[PHP-DB] ODBC Timout for MS SQL Driver

2003-03-03 Thread Ryan Jameson (USA)
Does anyone know a reliable way to set an ODBC connection to timeout after a very 
short time? I've tried set_time_limit but when the query is running PHP does not drop 
out, I've also tried odbc_setoption on the connection before executing. Basically, I 
want it to just fail quicker if it is going to. 30 seconds is too long.

 Ryan

Ryan Jameson
Software Development Services Manager 
International Bible Society
W (719) 867-2692

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



RE: [PHP-DB] ODBC Timout for MS SQL Driver

2003-03-03 Thread Ryan Jameson (USA)
Ok I tried this another way but using the ms sql functions along with:

ini_set(mssql.timeout,2);
ini_set(mssql.connect_timeout,2);

... no change, it still takes about 7-8 seconds to decide it couldn't connect.

 Ryan

-Original Message-
From: Ryan Jameson (USA) 
Sent: Monday, March 03, 2003 11:01 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] ODBC Timout for MS SQL Driver


Does anyone know a reliable way to set an ODBC connection to timeout after a very 
short time? I've tried set_time_limit but when the query is running PHP does not drop 
out, I've also tried odbc_setoption on the connection before executing. Basically, I 
want it to just fail quicker if it is going to. 30 seconds is too long.

 Ryan

Ryan Jameson
Software Development Services Manager 
International Bible Society
W (719) 867-2692

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


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



[PHP-DB] GD support in 4.3?

2003-03-03 Thread nate hurto
According to the GD web site http://www.boutell.com/gd/, there is native GD
support in v4.3.0.  Anyone know how to enable this support?

Thanks.
Nate.

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



Re: [PHP-DB] GD support in 4.3?

2003-03-03 Thread Rasmus Lerdorf
Wrong mailing list.

--with-gd

On Mon, 3 Mar 2003, nate hurto wrote:

 According to the GD web site http://www.boutell.com/gd/, there is native GD
 support in v4.3.0.  Anyone know how to enable this support?
 
 Thanks.
 Nate.
 
 


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



RE: [PHP-DB] How to access a MS Access DB

2003-03-03 Thread Beverly Steiner
Hello,

I'm new to this list and saw a past discussion in mid-Feb. about how to
access an MS Access DB.  I have Apache and PHP installed on my PC running XP
Professional.

I created a system DSN and got past the odbc_connect but it died in the
odbc_prepare statement.  Error message: Warning: odbc_prepare(): supplied
argument is not a valid ODBC-Link resource in c:\perl\htdocs\test2.php on
line 20
cannot prepare result

Here's my code (w/username and password changed):

$connection = odbc_connect(mctadb, username, password) || die(cannot
open database);

$sql = SELECT MeeetingTitle, MeetingDate FROM meeting;;

$sql_result = odbc_prepare($connection, $sql) || die(cannot prepare
result);

Any help would be greatly appreciated,

Beverly Steiner
[EMAIL PROTECTED]



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



RE: [PHP-DB] How to access a MS Access DB

2003-03-03 Thread Jonathan Villa
I believe I posted that thread.


Try odbc_exec instead of odbc_prepare

Let me know if have more problems
 
--- Jonathan
 
 
 

-Original Message-
From: Beverly Steiner [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 03, 2003 3:11 PM
To: [EMAIL PROTECTED]
Cc: Beverly Steiner
Subject: RE: [PHP-DB] How to access a MS Access DB

Hello,

I'm new to this list and saw a past discussion in mid-Feb. about how to
access an MS Access DB.  I have Apache and PHP installed on my PC
running XP
Professional.

I created a system DSN and got past the odbc_connect but it died in the
odbc_prepare statement.  Error message: Warning: odbc_prepare():
supplied
argument is not a valid ODBC-Link resource in c:\perl\htdocs\test2.php
on
line 20
cannot prepare result

Here's my code (w/username and password changed):

$connection = odbc_connect(mctadb, username, password) ||
die(cannot
open database);

$sql = SELECT MeeetingTitle, MeetingDate FROM meeting;;

$sql_result = odbc_prepare($connection, $sql) || die(cannot prepare
result);

Any help would be greatly appreciated,

Beverly Steiner
[EMAIL PROTECTED]



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



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



[PHP-DB] Confusing Date...

2003-03-03 Thread Doug Coning
I have a MySQL column that was set to date.

In my PHP page, I have a form and a field called 'Sch_StartDate'.  I'm
having difficultes understanding how to write to the date column in MySQL.
If I send 03/04/02for March 4, 2002, the value that gets stored in the
MySQL database is 2003-04-02 for April 2nd, 2003.

The field is set to to send as a date:
GetSQLValueString($HTTP_POST_VARS['Sch_StartDate'], date)

So how do I send dates to MySQL so that it stores it correctly?

Thank you!!

Confused,

Doug




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



RE: [PHP-DB] Confusing Date...

2003-03-03 Thread Beverly Steiner
Doug,

I know it works if you send the date as -mm-dd.  For example yesterday,
March 2, 2003 would be 2003-03-02

--
Beverly Steiner
[EMAIL PROTECTED]


-Original Message-
From: Doug Coning [mailto:[EMAIL PROTECTED]
Sent: Monday, March 03, 2003 5:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Confusing Date...


I have a MySQL column that was set to date.

In my PHP page, I have a form and a field called 'Sch_StartDate'.  I'm
having difficultes understanding how to write to the date column in MySQL.
If I send 03/04/02for March 4, 2002, the value that gets stored in the
MySQL database is 2003-04-02 for April 2nd, 2003.

The field is set to to send as a date:
GetSQLValueString($HTTP_POST_VARS['Sch_StartDate'], date)

So how do I send dates to MySQL so that it stores it correctly?

Thank you!!

Confused,

Doug




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


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



Re: [PHP-DB] Confusing Date...

2003-03-03 Thread 1LT John W. Holmes
 I have a MySQL column that was set to date.

 In my PHP page, I have a form and a field called 'Sch_StartDate'.  I'm
 having difficultes understanding how to write to the date column in MySQL.
 If I send 03/04/02for March 4, 2002, the value that gets stored in the
 MySQL database is 2003-04-02 for April 2nd, 2003.

 The field is set to to send as a date:
 GetSQLValueString($HTTP_POST_VARS['Sch_StartDate'], date)

 So how do I send dates to MySQL so that it stores it correctly?

MySQL expects the date in a -MM-DD or MMDD format. You can actually
use other characters as the delimiter instead of the dash (-) character, as
long as the year, month, and day are in the right order. As you've seen, you
can also pass it a two digit year and it'll assume what century you mean.

---John Holmes...


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



RE: [PHP-DB] Confusing Date...

2003-03-03 Thread Beverly Steiner
Doug,

Here's an example of how to format the date:

$date = 3/2/2003;

$good_date= date(Y-m-d, strtotime($date));

--
Beverly Steiner
[EMAIL PROTECTED]


-Original Message-
From: Doug Coning [mailto:[EMAIL PROTECTED]
Sent: Monday, March 03, 2003 5:38 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Confusing Date...


Yes, but not too many people are familiar with enter the year first,
followed by the month then the date.  Is there a way within PHP to take
03/02/2002 and send it as 2003-03-02.

Thanks,

Doug Coning
- Original Message -
From: Beverly Steiner [EMAIL PROTECTED]
To: Doug Coning [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, March 03, 2003 3:35 PM
Subject: RE: [PHP-DB] Confusing Date...


 Doug,

 I know it works if you send the date as -mm-dd.  For example
yesterday,
 March 2, 2003 would be 2003-03-02

 --
 Beverly Steiner
 [EMAIL PROTECTED]


 -Original Message-
 From: Doug Coning [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 03, 2003 5:29 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Confusing Date...


 I have a MySQL column that was set to date.

 In my PHP page, I have a form and a field called 'Sch_StartDate'.  I'm
 having difficultes understanding how to write to the date column in MySQL.
 If I send 03/04/02for March 4, 2002, the value that gets stored in the
 MySQL database is 2003-04-02 for April 2nd, 2003.

 The field is set to to send as a date:
 GetSQLValueString($HTTP_POST_VARS['Sch_StartDate'], date)

 So how do I send dates to MySQL so that it stores it correctly?

 Thank you!!

 Confused,

 Doug




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


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





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



[PHP-DB] Re: Update MD5 field

2003-03-03 Thread Fredrik de Vibe
[EMAIL PROTECTED] (Dani Matielo) writes:
 my problem is the following: I just imported a csv file to a MySQL database
 that contains name and email fields. It has about 9k lines on it and I need
 a new field that orinally didn't exist called code thats suposed to be
 
 MD5(name.email)
 
 I know how to do this for new data, but I don't know how to update all the
 old ones I already have there.

If I understand you correctly, this is probably something like what
you want to do:

ALTER TABLE foo ADD bar VARCHAR(20);

(don't know how long the field needs to be).

UPDATE foo SET bar = MD5(baz);


-- 
--Fredrik
Spare no expense to save money on this one.
-- Samuel Goldwyn

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



RE: [PHP-DB] Re: Update MD5 field

2003-03-03 Thread John W. Holmes
[snip]
 If I understand you correctly, this is probably something like what
 you want to do:
 
 ALTER TABLE foo ADD bar VARCHAR(20);
 
 (don't know how long the field needs to be).

MD5() result is always 32 characters.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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