🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: ba.php
Article #93

Re: How do u find the highest auto_generated ID number.

#93
From: Brian Tkatch
Date: Mon, 18 Sep 2000 00:00
46 lines
2081 bytes
Finding the largest number is simply SELECT MAX(Id) FROM Table;, but
is that what you want? Can't you just select from the table and see
what it returns. 

'SELECT * FROM <tablename> WHERE Id = ' . $Id . 'AND Password = "' .
$Password . '";

In Oracle I'd check if one of the fetch functions then returned true.
I'm not sure how t check that in MySQL.

Brian



On Mon, 18 Sep 2000 13:26:54 +0100, "Adrian Game"
<adgs_98@btinternet.com> wrote:

>I have a log in system that uses the auto_generated ID number + a password
>that is also stored in the same row.
>
>The code works fine for a proper ID number and password loging the user in
>but I want to stop errors that are
>caused when and ID number is used, that is not present in the database for
>when this hapens i get the following message
>
>Warning: Unable to jump to row 0 on MySQL result index 2 in
>c:\inetpub\wwwroot\linksdev\login.php3 on line 17
>
>This could be a potental secuirty risk so I need to stop this happening.
>
>I had thought of counting the number of rows in the database and stoping  ID
>that are larger than the number of rows
>but this would cause problems if users delete the information removing a
>row.  This would mean that altough there might be 22 rows the last ID still
>might be 23 as an earlyer entry has been removed.
>
>If you have any ideas or would like a better explination please let me know!
>
>
>Adrian
>
>http://www.devilsbeach.co.uk
>
>
>
>
Technical Details
Message-ID: <39c615c8.1793285843@news.alt.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8q51i8$nut$1@neptunium.btinternet.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108904,d4a6c26383bfa6a2
X-Google-Attributes: gid108904,public
X-Google-Thread: 10ce1c,d4a6c26383bfa6a2
X-Google-Attributes: gid10ce1c,public
From: SPAMBLOCK.Maxwell_Smart@ThePentagon.com.SPAMBLOCK (Brian Tkatch)
Subject: Re: How do u  find the highest auto_generated ID number.
Date: 2000/09/18
Message-ID: <39c615c8.1793285843@news.alt.net>
X-Deja-AN: 671186800
References: <8q51i8$nut$1@neptunium.btinternet.com>
Organization: Altopia Corp. - Usenet Access - http://www.altopia.com
Newsgroups: ba.php,mailing.www.php-user