🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Adrian Game Mon, 18 Sep 2000 00:00
How do u find the highest auto_generated ID number.
#92
Author: Adrian Game
Date: Mon, 18 Sep 2000 00:00
25 lines
1573 bytes
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
Re: How do u find the highest auto_generated ID number.
#93
Author: 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
>
>
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads