Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Whether a userid is already in databse

Reply
Thread Tools

Whether a userid is already in databse

 
 
Regent
Guest
Posts: n/a
 
      01-02-2004
Hi friends,

I'm doing some cgi programming these days, using MS Access database to store uid/pwd info from registration forms in HTML pages. I considered

SELECT from Users WHERE userid = '$uid'

to see whether the received uid (from webpage forms) is already in the database, but I guess there may be more convenient ways to do this?

Thanks for ur advice!

Regent
http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
 
 
 
Tintin
Guest
Posts: n/a
 
      01-02-2004

"Regent" <(E-Mail Removed)> wrote in message
news:bt2nnc$1ed8$(E-Mail Removed)99.com...
> Hi friends,
>
> I'm doing some cgi programming these days, using MS Access database to

store uid/pwd info from registration forms in HTML pages. I considered
>
> SELECT from Users WHERE userid = '$uid'
>
> to see whether the received uid (from webpage forms) is already in the

database, but I guess there may be more convenient ways to do this?

What would Perl programmers know or care about SQL.


 
Reply With Quote
 
 
 
 
Nick Santos
Guest
Posts: n/a
 
      01-02-2004

"Regent" <(E-Mail Removed)> wrote in message
news:bt2nnc$1ed8$(E-Mail Removed)99.com...
> Hi friends,
>
> I'm doing some cgi programming these days, using MS Access database to

store uid/pwd info from registration forms in HTML pages. I considered
>
> SELECT from Users WHERE userid = '$uid'
>
> to see whether the received uid (from webpage forms) is already in the

database, but I guess there may be more convenient ways to do this?
>
> Thanks for ur advice!
>
> Regent
> (E-Mail Removed)
>

I use MySql, and that's the way I do it, simply checking to see if anything
is returned. I think it's fairly effective, because it doesn't require much
coding either.


 
Reply With Quote
 
Regent
Guest
Posts: n/a
 
      01-02-2004

------------------------
Fri, 02 Jan 2004 04:00:51 GMT úČNick Santos wrote:
>>

>I use MySql, and that's the way I do it, simply checking to see if anything
>is returned. I think it's fairly effective, because it doesn't require much
>coding either.
>


Thanks, and how do you check by the way?

------------------------
Regent
(E-Mail Removed)

 
Reply With Quote
 
Keith Keller
Guest
Posts: n/a
 
      01-02-2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2004-01-02, Tintin <(E-Mail Removed)> wrote:
>
> What would Perl programmers know or care about SQL.


Many Perl programmers know and care about SQL. Why any of them should
answer SQL questions in a Perl newsgroup is another question altogether.

- --keith

- --
http://www.velocityreviews.com/forums/(E-Mail Removed)-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/9RWchVcNCxZ5ID8RAnKwAJ9Du/s2oR0pmeyteNxjM1AGAHJIwACeMN3/
5u39HJyjfY7wXPwmYBQyXWU=
=NMz2
-----END PGP SIGNATURE-----
 
Reply With Quote
 
Lawrence D╣Oliveiro
Guest
Posts: n/a
 
      01-02-2004
In article <bt2nva$2qi0e$(E-Mail Removed)-berlin.de>,
"Tintin" <(E-Mail Removed)> wrote:

>What would Perl programmers know or care about SQL.


I write a lot of Perl (as well as C and other languages), and I use a
lot of SQL with it. I have also used PHP with SQL, and guess what--I
think Perl DBI is more advanced than anything PHP can offer.
 
Reply With Quote
 
Gregory Toomey
Guest
Posts: n/a
 
      01-02-2004
It was a dark and stormy night, and Tintin managed to scribble:

>
> "Regent" <(E-Mail Removed)> wrote in message
> news:bt2nnc$1ed8$(E-Mail Removed)99.com...
>> Hi friends,
>>
>> I'm doing some cgi programming these days, using MS Access database to

> store uid/pwd info from registration forms in HTML pages. I considered
>>
>> SELECT from Users WHERE userid = '$uid'
>>
>> to see whether the received uid (from webpage forms) is already in the

> database, but I guess there may be more convenient ways to do this?
>
> What would Perl programmers know or care about SQL.


Lots. Well I've been using SQL for 15 years, and answer a lot of SQL questions here.

The above query I would probably change to
SELECT count(*) kount from Users WHERE userid = '$uid'

then test for kount>0 (using the DBI syntax to reference kount).

gtoomey
 
Reply With Quote
 
Regent
Guest
Posts: n/a
 
      01-02-2004
>Lots. Well I've been using SQL for 15 years, and answer a lot of SQL questions here.
>
>The above query I would probably change to
>SELECT count(*) kount from Users WHERE userid = '$uid'
>
>then test for kount>0 (using the DBI syntax to reference kount).


>gtoomey


Thanks. The idea is to check if the uid already exists and if not INSERT the new user into the db.
Now that the SELECT is already a filter, I think this filter must be cancelled before the INSERT operation, right? How do I cancel this filter without disconnecting the db? Thanks again

------------------------
Regent
(E-Mail Removed)

 
Reply With Quote
 
Regent
Guest
Posts: n/a
 
      01-02-2004
>Lots. Well I've been using SQL for 15 years, and answer a lot of SQL questions here.
>
>The above query I would probably change to
>SELECT count(*) kount from Users WHERE userid = '$uid'
>
>then test for kount>0 (using the DBI syntax to reference kount).


>gtoomey


Thanks. The idea is to check if the uid already exists and if not INSERT the new user into the db.
Now that the SELECT is already a filter, I think this filter must be cancelled before the INSERT operation, right? How do I cancel this filter without disconnecting the db? Thanks again

------------------------
Regent
(E-Mail Removed)

 
Reply With Quote
 
Gregory Toomey
Guest
Posts: n/a
 
      01-02-2004
It was a dark and stormy night, and Regent managed to scribble:

>>Lots. Well I've been using SQL for 15 years, and answer a lot of SQL
>>questions here.
>>
>>The above query I would probably change to
>>SELECT count(*) kount from Users WHERE userid = '$uid'
>>
>>then test for kount>0 (using the DBI syntax to reference kount).

>
>>gtoomey

>
> Thanks. The idea is to check if the uid already exists and if not INSERT
> the new user into the db. Now that the SELECT is already a filter, I think
> this filter must be cancelled before the INSERT operation, right? How do I
> cancel this filter without disconnecting the db? Thanks again
>
> ------------------------
> Regent
> (E-Mail Removed)


I'd just do an insert, and check the return code. If its OK, or record already present, then that's whay you want.

If you do a select followed by insert, you are adding an extra database access. This may be significant if you are dealing with lots of records.

gtoomey
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find whether our application is already running LaHiRU C++ 3 08-24-2009 05:02 PM
how to check whether an event has been already handled in IE ? wolverine Javascript 1 08-23-2007 09:36 AM
how to check whether an event has been already handled in IE ? wolverine Javascript 0 08-23-2007 05:48 AM
How to determine whether the user has already selected an option from a multi select list Patrick Olurotimi Ige ASP .Net 6 03-11-2005 10:39 AM
Re: Connecting my application to a SQL Server-databse Ashish M Bhonkiya ASP .Net 0 05-05-2004 05:17 AM



Advertisments