[PHP-DB] áéíóúÁÉÍÓÚñÑ

2003-01-15 Thread Bernain, Fernando G.
How can I query this characters 'áéíóúÁÉÍÓÚñÑ' from a MSSQL DB with PHP???
Actually I obtain this: ' '¡¢£µÖà餥'!!!

Thanks

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]





Email Disclaimer

The information in this email is confidential and may be
legally privileged.
It is intended solely for the addressee.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure,
copying, distribution
or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice
contained in this email are subject to the terms and
conditions expressed in the governing KPMG client engagement
letter.


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




RE: [PHP-DB] Users on line

2003-01-06 Thread Bernain, Fernando G.
OK, guys, thanks!! I'll try it and then I'll tell you!!!

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 7:10 PM
To: Bernain, Fernando G.; 'Peter Beckman'; Hutchins, Richard
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Users on line


Hi

My bank uses two processes. If a user is inactive for more than about 5
minutes it forces you to log in again. This is done server side and just
does not allow you to do anything if your last activity was more than 5
minutes ago. It probably also marks the session as logged out.

It also uses JavaScript body onUnload='' to log you out when you close the
window. Not sure if this works when you just close the browser.

I do have a suggestion, which may or may not meet your needs.

When the user logs in, open a popup window  and set focus to the main window
body unload=self.focus()  so the popup becomes a popunder. Using a header
or meta tag refresh the popunder once a minute and log the session as
already discussed, but with a timeout of 2 minutes, so it will be up to
date. This will tell you that the user has a browser open.

This might be enough for your needs

If not you could use body onUnload='' to post a form to the popup window
when the main window closes. This logs out when the user closes the main
window. The only exception will be if the user navigates away from the site.
If you need to, you could prevent this by displaying site content in another
popup window with no navbar and no external links.

http is stateless, so you cannot do a true session like Messenger but the
above is reasonably close :)

HTH

Peter

---
Excellence in internet and open source software
---
Sunmaia
Birmingham
UK
www.sunmaia.net
tel. 0121-242-1473
International +44-121-242-1473
---

-Original Message-
From: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]]
Sent: 03 January 2003 20:31
To: 'Peter Beckman'; Hutchins, Richard
Cc: Bernain, Fernando G.; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Users on line


I'm thinking in something similar to ICQ or MSN. This is an app for a few
number of users (less than 50) but they need to know who are online when
they are working in the app too!!! Maybe I can use the table online and
insert then name of the user when he login the app... but I still have the
problem of the logout...

I was looking for something (like a function?) in apache or php who tells me
the open sessions at a moment...

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Peter Beckman [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 4:49 PM
To: Hutchins, Richard
Cc: Bernain, Fernando G.; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Users on line


I agree; it'd be nice if there was some sort of code that'd be executed
when someone closed their browser.  There is the javascript on_exit() or
something where the user, when they leave a domain, is executed.  However,
this only works if they click off the site, not if they close their
browser.  Plus if they go to another site and come back within 5/10/15
minutes, are they still considered logged in?

It's fairly impossible to keep track of when users are or are not using the
site that is not really complex.  What if they are reading an article, run
to the restroom, finish reading the article and then click on another page?
I figure they are idle after 15 minutes.  If they continue to surf the
site in an hour or two, their session will be updated (if your sessions
last long enough, or if not they'll probably be automatically re-logged in
which case they'd be updated/re-inserted in the online table), and will
once again be counted as a person online.

One example is forcing people to be logged out after 10 minutes of
inactivity.  Bank of America does this, most likely using javascript.
However, if yahoo! did this when I was reading my mail and I stepped away,
I'd be annoyed.  Most sites allow you to be logged in forever (Remember
me) so forcing people to log out just to be able to count who is online
seems silly.

If you just want to keep track of how many people are logged in, I'd just
say that logged in is defined as having an active logged in session that
was active in the last 5/10/15 minutes.  I'm almost positive that method is
how most web sites determine time online.

Peter

On Fri, 3 Jan 2003, Hutchins, Richard wrote:

 How would the online table be maintained if a user simply closes out the
 browser without actually logging out properly? I'm not at all experienced
 with sessions, but closing the browser should terminate the session,
 correct? Bernain may want to delete from his online

RE: [PHP-DB] displaying a MySQL date in a different format

2003-01-06 Thread Bernain, Fernando G.
I dont know if its the best solution, but I made a function that cut the
date:

function sqldate($fecha) {

$dia=substr($fecha,0,2);
$mes=substr($fecha,3,2);
$anio=substr($fecha,6,4);

$fechasql=$anio./.$mes./.$dia;

return $fechasql;

}

You input 12/01/2002 and output 2002/01/12


Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Ali McLeod [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 04, 2003 8:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] displaying a MySQL date in a different format


Can anyone help me. I am trying to display a date in a different format from
that stored in a MySQL database. MySQL forces you to store it as -mm-dd
but I want to display it as dd-mm-, or dd-

Any ideas?

Many thanks in advance

Ali McLeod
[EMAIL PROTECTED]



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


Email Disclaimer

The information in this email is confidential and may be
legally privileged.
It is intended solely for the addressee.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure,
copying, distribution
or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice
contained in this email are subject to the terms and
conditions expressed in the governing KPMG client engagement
letter.


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




[PHP-DB] Special characters

2003-01-06 Thread Bernain, Fernando G.
I'm working with MSSQL7.0 Apache 1.3.19 and PHP4.2.3
When I select a table with this kind of characters: ó The output is ¢...

I have the same problem with the others vocals (á-é-í-ú)

What can I do??? Forgot the spanish??? 

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]





Email Disclaimer

The information in this email is confidential and may be
legally privileged.
It is intended solely for the addressee.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure,
copying, distribution
or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice
contained in this email are subject to the terms and
conditions expressed in the governing KPMG client engagement
letter.


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




RE: [PHP-DB] Special characters

2003-01-06 Thread Bernain, Fernando G.
I can't modify the character set of my MSSQL...
(Character Set = 1, iso_1 ISO 8859-1 (Latin-1) - Western European 8-bit
character set.)

And I NEDD the á-é-í-ó-ú-ñ

Any idea?

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 06, 2003 2:30 PM
To: Bernain, Fernando G.; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Special characters


  Fernando,
 try to store you data in unicode (utf8) for example.
You iconv to transform if it is needed.

Andrey

- Original Message -
From: Bernain, Fernando G. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 06, 2003 7:25 PM
Subject: [PHP-DB] Special characters


 I'm working with MSSQL7.0 Apache 1.3.19 and PHP4.2.3
 When I select a table with this kind of characters: ó The output is
¢...

 I have the same problem with the others vocals (á-é-í-ú)

 What can I do??? Forgot the spanish???

 Fernando Bernain
 Senior A
 Business Process Outsourcing

 KPMG Argentina
 Tel: 54 11 4316 5754
 Fax: 54 11 4316 5734
 [EMAIL PROTECTED]





 Email Disclaimer

 The information in this email is confidential and may be
 legally privileged.
 It is intended solely for the addressee.
 Access to this email by anyone else is unauthorised.
 If you are not the intended recipient, any disclosure,
 copying, distribution
 or any action taken or omitted to be taken in reliance
 on it, is prohibited and may be unlawful.
 When addressed to our clients any opinions or advice
 contained in this email are subject to the terms and
 conditions expressed in the governing KPMG client engagement
 letter.


 --
 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] Users on line

2003-01-03 Thread Bernain, Fernando G.
I'm working in an app that requires to know who are on line. When the user
login the app, I use session in order to storage de name and login.  Its
posible to do this???

Thanks!

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]





Email Disclaimer

The information in this email is confidential and may be
legally privileged.
It is intended solely for the addressee.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure,
copying, distribution
or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice
contained in this email are subject to the terms and
conditions expressed in the governing KPMG client engagement
letter.


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




RE: [PHP-DB] Users on line

2003-01-03 Thread Bernain, Fernando G.
I'm thinking in something similar to ICQ or MSN. This is an app for a few
number of users (less than 50) but they need to know who are online when
they are working in the app too!!! Maybe I can use the table online and
insert then name of the user when he login the app... but I still have the
problem of the logout...

I was looking for something (like a function?) in apache or php who tells me
the open sessions at a moment...

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Peter Beckman [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 4:49 PM
To: Hutchins, Richard
Cc: Bernain, Fernando G.; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Users on line


I agree; it'd be nice if there was some sort of code that'd be executed
when someone closed their browser.  There is the javascript on_exit() or
something where the user, when they leave a domain, is executed.  However,
this only works if they click off the site, not if they close their
browser.  Plus if they go to another site and come back within 5/10/15
minutes, are they still considered logged in?

It's fairly impossible to keep track of when users are or are not using the
site that is not really complex.  What if they are reading an article, run
to the restroom, finish reading the article and then click on another page?
I figure they are idle after 15 minutes.  If they continue to surf the
site in an hour or two, their session will be updated (if your sessions
last long enough, or if not they'll probably be automatically re-logged in
which case they'd be updated/re-inserted in the online table), and will
once again be counted as a person online.

One example is forcing people to be logged out after 10 minutes of
inactivity.  Bank of America does this, most likely using javascript.
However, if yahoo! did this when I was reading my mail and I stepped away,
I'd be annoyed.  Most sites allow you to be logged in forever (Remember
me) so forcing people to log out just to be able to count who is online
seems silly.

If you just want to keep track of how many people are logged in, I'd just
say that logged in is defined as having an active logged in session that
was active in the last 5/10/15 minutes.  I'm almost positive that method is
how most web sites determine time online.

Peter

On Fri, 3 Jan 2003, Hutchins, Richard wrote:

 How would the online table be maintained if a user simply closes out the
 browser without actually logging out properly? I'm not at all experienced
 with sessions, but closing the browser should terminate the session,
 correct? Bernain may want to delete from his online table every hour or so
 to catch those people who have not properly logged out (assuming the
delete
 from online... query is only fired when they click on a log out
button).

 I'm not slagging Peter's recommendation. I was thinking this solution
 through as well, but was a bit stuck when it came to users just closing
 their browsers without logging out.

  -Original Message-
  From: Peter Beckman [mailto:[EMAIL PROTECTED]]
  Sent: Friday, January 03, 2003 2:32 PM
  To: Bernain, Fernando G.
  Cc: '[EMAIL PROTECTED]'
  Subject: Re: [PHP-DB] Users on line
 
 
  Create a new table named online:
 
  id
  time (int unix timestamp)
  uid (int probably, user ID of user in question, relating to a
  user info table?)
  sessid (char 32 I think)
 
  When the user logs in, I assume you set the session.  Insert
  a row with the
  current time (unix_timestamp(now()), User ID and the output
  of session_id()
  in PHP.  This way you can run a query on that table at any
  time in one of
  two ways.
 
   1. select count(id) from online where
  time=(unix_timestamp(now())-900)
 
  This will give you the number of people who at least
  logged in in the
  last 15 minutes.  This isn't very accurate though... so
 
   2. If not already, put sessions in your SQL table.  This way
  you can run a
  query like (and John Holmes, please feel free to clean up
  my joins, i
  suck at them):
 
  select count(*) from online,sessions where
  online.sessid=sessions.sessid and
  sessions.date=(unix_timestamp(now())-900)
 
  This will give you the number of users who have done
  anything on the
  site in the last 15 minutes.  Change the 900 to 600 or
  300 for 10 or 5
  minutes respectively.
 
  Every week or so you'll want to delete from online where time=[some
  number here, unix_timestamp(now()) minus how long you want to
  leave those
  entries there].
 
  Depending on how often you want to do this and how busy your
  site is and
  how focused on performance you are, I'd advise running it
  once per minute
  and every time someone logs in, rather than once per page
  view, and put the
  values generated into a text file and read it in with readfile().
 
  Peter
 
  On Fri, 3 Jan 2003, Bernain, Fernando G. wrote:
 
   I'm working

RE: [PHP-DB] Re: NewB: Return New Record ID...

2002-12-26 Thread Bernain, Fernando G.
This is from de books online (MSSQL).

@@IDENTITY (T-SQL)
Returns the last-inserted identity value. 

Syntax
@@IDENTITY

Return Types
numeric

Remarks
After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY
contains the last identity value generated by the statement. If the
statement did not affect any tables with identity columns, @@IDENTITY
returns NULL. If multiple rows are inserted, generating multiple identity
values, @@IDENTITY returns the last identity value generated. If the
statement fires one or more triggers that perform inserts that generate
identity values, calling @@IDENTITY immediately after the statement returns
the last identity value generated by the triggers. The @@IDENTITY value does
not revert to a previous setting if the INSERT or SELECT INTO statement or
bulk copy fails, or if the transaction is rolled back.

Examples
This example inserts a row into a table with an identity column and uses
@@IDENTITY to display the identity value used in the new row.

INSERT INTO jobs (job_desc,min_lvl,max_lvl)

VALUES ('Accountant',12,125)

SELECT @@IDENTITY AS 'Identity'

  

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


for MS SQL and Oracle does anyone know a more reliable way to do this than
select max(ID) immediately after the insert? It seems silly that I'd have to
take my chances that another has been inserted in between.

 Ryan

-Original Message-
From: J.Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 1:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: NewB: Return New Record ID...


Try $last=mysql_insert_id();

Jochem

Doug Coning wrote:
 Hi all,
 
 How do I do this:
 
 I need a PHP page that simply creates a blank record so that I have the
 record's ID (which is automatically generated).  That same page then needs
 to return the record ID back so that I know what the ID is.  I will later
 allow that record's information to be populated based on the ID it first
 returned.
 
 How would I do this?
 
 Thank you, thank you!
 
 Doug Coning
 
 
 


-- 
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


Email Disclaimer

The information in this email is confidential and may be
legally privileged.
It is intended solely for the addressee.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure,
copying, distribution
or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice
contained in this email are subject to the terms and
conditions expressed in the governing KPMG client engagement
letter.


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




RE: [PHP-DB] Re: NewB: Return New Record ID...

2002-12-26 Thread Bernain, Fernando G.
You can use this inside an stored procedure, for instance:

CREATE PROCEDURE SP_INSERT_TRANSACCION
@transacfecha datetime,
@observacion char(100)
 AS
INSERT INTO Transaccion(transacfecha, observacion)
VALUES(
@transacfecha,
@observacion
)
SELECT @@IDENTITY AS 'nrotrans'
END

In this example, I insert two values with this sp in a table with and
Identity column. So, the SP return the value of the transaccion generated...
You've got the idea???


Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 2:36 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


This doesn't work as expected through ODBC... it does not seem to return any
value...

 Ryan

-Original Message-
From: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 10:09 AM
To: Ryan Jameson (USA)
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


This is from de books online (MSSQL).

@@IDENTITY (T-SQL)
Returns the last-inserted identity value. 

Syntax
@@IDENTITY

Return Types
numeric

Remarks
After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY
contains the last identity value generated by the statement. If the
statement did not affect any tables with identity columns, @@IDENTITY
returns NULL. If multiple rows are inserted, generating multiple identity
values, @@IDENTITY returns the last identity value generated. If the
statement fires one or more triggers that perform inserts that generate
identity values, calling @@IDENTITY immediately after the statement returns
the last identity value generated by the triggers. The @@IDENTITY value does
not revert to a previous setting if the INSERT or SELECT INTO statement or
bulk copy fails, or if the transaction is rolled back.

Examples
This example inserts a row into a table with an identity column and uses
@@IDENTITY to display the identity value used in the new row.

INSERT INTO jobs (job_desc,min_lvl,max_lvl)

VALUES ('Accountant',12,125)

SELECT @@IDENTITY AS 'Identity'

  

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


for MS SQL and Oracle does anyone know a more reliable way to do this than
select max(ID) immediately after the insert? It seems silly that I'd have to
take my chances that another has been inserted in between.

 Ryan

-Original Message-
From: J.Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 1:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: NewB: Return New Record ID...


Try $last=mysql_insert_id();

Jochem

Doug Coning wrote:
 Hi all,
 
 How do I do this:
 
 I need a PHP page that simply creates a blank record so that I have the
 record's ID (which is automatically generated).  That same page then needs
 to return the record ID back so that I know what the ID is.  I will later
 allow that record's information to be populated based on the ID it first
 returned.
 
 How would I do this?
 
 Thank you, thank you!
 
 Doug Coning
 
 
 


-- 
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


Email Disclaimer

The information in this email is confidential and may be
legally privileged.
It is intended solely for the addressee.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure,
copying, distribution
or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice
contained in this email are subject to the terms and
conditions expressed in the governing KPMG client engagement
letter.


-- 
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] Re: NewB: Return New Record ID...

2002-12-26 Thread Bernain, Fernando G.
It's not a bad idea to encapsulate de querys (selects, updates, inserts,...)
in SPs...

Good luck with the select max()!!!

PD: If you dont want/can use identitys, maybe you can use another table
where you store de next number of transaction. So its easy to update this
number (plus one) and make a select inmediatley to obtein the number... its
a bit strange but it works!!!

Buena suerte!!!

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 2:46 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


The problem is I have hundreds of tables each with a different column list
and syntax, I don't want to have to create a SP for each table. There really
has to be an easy way to do this. Now my sql server is saying this:

Connection is busy with results for another hstmt, SQL state S1000

. it looks like I'll have to take my chances with select max() 

 Ryan

-Original Message-
From: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 10:43 AM
To: Ryan Jameson (USA)
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


You can use this inside an stored procedure, for instance:

CREATE PROCEDURE SP_INSERT_TRANSACCION
@transacfecha datetime,
@observacion char(100)
 AS
INSERT INTO Transaccion(transacfecha, observacion)
VALUES(
@transacfecha,
@observacion
)
SELECT @@IDENTITY AS 'nrotrans'
END

In this example, I insert two values with this sp in a table with and
Identity column. So, the SP return the value of the transaccion generated...
You've got the idea???


Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 2:36 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


This doesn't work as expected through ODBC... it does not seem to return any
value...

 Ryan

-Original Message-
From: Bernain, Fernando G. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 10:09 AM
To: Ryan Jameson (USA)
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


This is from de books online (MSSQL).

@@IDENTITY (T-SQL)
Returns the last-inserted identity value. 

Syntax
@@IDENTITY

Return Types
numeric

Remarks
After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY
contains the last identity value generated by the statement. If the
statement did not affect any tables with identity columns, @@IDENTITY
returns NULL. If multiple rows are inserted, generating multiple identity
values, @@IDENTITY returns the last identity value generated. If the
statement fires one or more triggers that perform inserts that generate
identity values, calling @@IDENTITY immediately after the statement returns
the last identity value generated by the triggers. The @@IDENTITY value does
not revert to a previous setting if the INSERT or SELECT INTO statement or
bulk copy fails, or if the transaction is rolled back.

Examples
This example inserts a row into a table with an identity column and uses
@@IDENTITY to display the identity value used in the new row.

INSERT INTO jobs (job_desc,min_lvl,max_lvl)

VALUES ('Accountant',12,125)

SELECT @@IDENTITY AS 'Identity'

  

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Re: NewB: Return New Record ID...


for MS SQL and Oracle does anyone know a more reliable way to do this than
select max(ID) immediately after the insert? It seems silly that I'd have to
take my chances that another has been inserted in between.

 Ryan

-Original Message-
From: J.Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 1:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: NewB: Return New Record ID...


Try $last=mysql_insert_id();

Jochem

Doug Coning wrote:
 Hi all,
 
 How do I do this:
 
 I need a PHP page that simply creates a blank record so that I have the
 record's ID (which is automatically generated).  That same page then needs
 to return the record ID back so that I know what the ID is.  I will later
 allow that record's information to be populated based on the ID it first
 returned.
 
 How would I do this?
 
 Thank you, thank you!
 
 Doug Coning
 
 
 


-- 
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


Email Disclaimer

RE: [PHP-DB] Questions regarding primary keys, updates, and autoincrement

2002-12-23 Thread Bernain, Fernando G.
Michael, why do you need to link de manufacturer table with de product
table? I think that you have to clarify the design of your db and your
business rules first... for instance, if you have to reuse the IDs (the
barcode and de manufa cturer ID), then you will create new tables in order
to preserve your history (I supouse that it will be interesting to know that
in 1999 the transactions of the ID 111 corresponds to Michael!!).

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]




-Original Message-
From: Michael Conway [mailto:[EMAIL PROTECTED]]
Sent: Saturday, December 21, 2002 9:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Questions regarding primary keys, updates, and
autoincrement


 

I have been working on an e-business project and have a product table
and manufacturer table that are linked via barcode and a manufacturer ID
(both primary keys in the tables mentioned).  For now, I have been
setting the manufacturer's ID manually, primarily for that rare instance
where a manufacturer and its products are dropped from the database, but
the number should be reused.  Is it better or possible (without
complications) to use autoincrement and simply delete the product
information and manufacturer information while leaving the ID column
intact for a later update operation with a new manufacturer and its
products? I suppose only one table (the linking table?) should be set to
autoincrement and that ID number used to populate the remaining tables
depending upon that number for insert operations.  The code is probably
simple, but my head is already swimming.  I suppose what I am looking
for is best practice advice from seasoned db administrators.

 

A second question, which may be moot if autoincrement is the best way to
go, is why I keep getting an duplicate key error despite using IGNORE in
my mysql update scripts.  Keep in mind that the update is completed
anyway (even without using IGNORE) but the abort prevents an
acknowledgement script which is essential in unregistering sessions
crucial in future update operations.

 

Thanks.

Michael Conway

[EMAIL PROTECTED]

(703) 968-8875

 



Email Disclaimer

The information in this email is confidential and may be
legally privileged.
It is intended solely for the addressee.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure,
copying, distribution
or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice
contained in this email are subject to the terms and
conditions expressed in the governing KPMG client engagement
letter.


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




[PHP-DB] Crystal Report - PHP4 / Report Generator

2002-12-11 Thread Bernain, Fernando G.
I'm working in a migration of an application from MSSQL7-VB6.0-Crystal
Reports to MSSQL7-winApache-PHP4. 
I'm having problems with the reporting, because I cant find an user
friendly solution for the creation of reports with PHP (I need something
similar in functionality and look and fell to the Crystal Reports). 
I tried with a class report wrote in PHP4 but I saw that I'll have a long
way to obtain a minimum level of functionality... 

Am I following the correct way in solving this problem??? 
Have anybody of you developed something similar to a Report Generator???
Does exist any application that I could use??? 

Thanks

Fernando Bernain
Senior A
Business Process Outsourcing

KPMG Argentina
Tel: 54 11 4316 5754
Fax: 54 11 4316 5734
[EMAIL PROTECTED]





Email Disclaimer

The information in this email is confidential and may be
legally privileged.
It is intended solely for the addressee.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure,
copying, distribution
or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful.
When addressed to our clients any opinions or advice
contained in this email are subject to the terms and
conditions expressed in the governing KPMG client engagement
letter.


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