newbee question

2005-08-27 Thread ross
Using mysql with php I have a database that has a unique value for the user id. 
when people get delete off the list I want the unique numbers to compact down 
so.

user id 1
user id 4
user id 5
user id 7
user id 9
user id 10

becomes 

user id 1
user id 2
user id 3
user id 4
user id 5
user id 6

If this is not possible how can I find the first entry in the database and last 
entry with php/mysql?

R.

Re: newbee question

2005-08-27 Thread leegold

On Sat, 27 Aug 2005 19:43:57 +0100, [EMAIL PROTECTED] said:
 Using mysql with php I have a database that has a unique value for the
 user id. when people get delete off the list I want the unique numbers to
 compact down so.
 
 user id 1
 user id 4
 user id 5
 user id 7
 user id 9
 user id 10
 
 becomes 
 
 user id 1
 user id 2
 user id 3
 user id 4
 user id 5
 user id 6
 
 If this is not possible how can I find the first entry in the database
 and last entry with php/mysql?

Not an answer, sorry. But just wondering, you said user id is unique. Is
it a primary key? Maybe you should leave it alone, else you're gonna
have trouble...
:^ )

Lee G.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: newbee question

2005-08-27 Thread Stijn Verholen

leegold wrote:

On Sat, 27 Aug 2005 19:43:57 +0100, [EMAIL PROTECTED] said:


Using mysql with php I have a database that has a unique value for the
user id. when people get delete off the list I want the unique numbers to
compact down so.

user id 1
user id 4
user id 5
user id 7
user id 9
user id 10

becomes 


user id 1
user id 2
user id 3
user id 4
user id 5
user id 6

If this is not possible how can I find the first entry in the database
and last entry with php/mysql?



Not an answer, sorry. But just wondering, you said user id is unique. Is
it a primary key? Maybe you should leave it alone, else you're gonna
have trouble...
:^ )

Lee G.




ORDER BY unique user id DESC/ASC LIMIT 1


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: newbee question

2005-08-27 Thread Peter Brawley




Ross

Using mysql with php I have a database that has a unique value 
for the user id. when people get delete off the list I want the
unique 
numbers to compact down so.

Generally it's a really bad idea to edit primary keys. If you
absolutely must compact the key values, you can do it by altering the
table
to drop the primary key, then run something like this,
 SET @i=0;
 UPDATE parent2 SET id=(@i:[EMAIL PROTECTED]); 
then alter the table again to re-establish the primary key.

If this is not possible how can I find the first entry in 
the database and last entry with php/mysql?

To find the lowest id value
 SELECT id FROM tablename ORDER BY id ASC LIMIT 1;
and to find the highest
 SELECT id FROM tablename ORDER BY id DEC LIMIT 1;

PB
http://www/artfulsoftware.com

-

[EMAIL PROTECTED] wrote:

  Using mysql with php I have a database that has a unique value for the user id. when people get delete off the list I want the unique numbers to compact down so.

user id 1
user id 4
user id 5
user id 7
user id 9
user id 10

becomes 

user id 1
user id 2
user id 3
user id 4
user id 5
user id 6

If this is not possible how can I find the first entry in the database and last entry with php/mysql?

R.
  
  

No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 8/26/2005
  



No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 8/26/2005


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: newbee question

2005-08-27 Thread Peter Brawley

Ross

Apologies for the typo, the snippet for finding the highest id should say

 SELECT id FROM tablename ORDER BY id DESC LIMIT 1;

PB



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 8/26/2005


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Newbee Question !

2001-01-25 Thread Khuon Tech


Dear lists members,

I gonna download MySQL and PHP to install on my machine.
But the problem is that I don't know which tarballs are required to
do from mysql.com and php.net.
I mean I would like to manage databases using HTML interface (MySQL/PHP).

Any points or links to the web sites are highly appreciated.

Thank you very much indeed.

TK Tech
(Linux Newbee)


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Newbee Question !

2001-01-25 Thread Khuon Tech


Oh...Yeah I forgot to mention it.

It's Red Hat kernel 2.2.16.
Apache x.x.19. Browser Mozilla/Netscape.
I would like also to verify all users to give their Username/Password to
access my database.

This Computer gonna be both Server for my team project and Client for me.
I mean I'll test and manage the databases too.

Thanks again.

On Thu, 25 Jan 2001, Jorma Jakowitsch wrote:

 It would be best to know what kind of Linux you have? SuSE? Mandrake?
 whatever..
 What kind of Computer? Depending on this information it IS very easy to find
 the required tarballs
 
 Hope it helps - Jim
 
  -Original Message-
  From: Khuon Tech [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, January 25, 2001 10:10 AM
  To: MySQL forum
  Subject: Newbee Question !
 
 
 
  Dear lists members,
 
  I gonna download MySQL and PHP to install on my machine.
  But the problem is that I don't know which tarballs are required to
  do from mysql.com and php.net.
  I mean I would like to manage databases using HTML interface (MySQL/PHP).
 
  Any points or links to the web sites are highly appreciated.
 
  Thank you very much indeed.
 
  TK Tech
  (Linux Newbee)
 
 
  -
  Before posting, please check:
 http://www.mysql.com/manual.php   (the manual)
 http://lists.mysql.com/   (the list archive)
 
  To request this thread, e-mail [EMAIL PROTECTED]
  To unsubscribe, e-mail
  [EMAIL PROTECTED]
  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 
 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Newbee Question !

2001-01-25 Thread Khuon Tech



Oh...Yeah I forgot to mention it.

It's Red Hat kernel 2.2.16.
Apache x.x.19. Browser Mozilla/Netscape.
I would like also to verify all users to give their Username/Password to
access my database.

This Computer gonna be both Server for my team project and Client for me.
I mean I'll test and manage the databases too.

Thanks again.

On Thu, 25 Jan 2001, Jorma Jakowitsch wrote:

 It would be best to know what kind of Linux you have? SuSE? Mandrake?
 whatever..
 What kind of Computer? Depending on this information it IS very easy to find
 the required tarballs
 
 Hope it helps - Jim
 
  -Original Message-
  From: Khuon Tech [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, January 25, 2001 10:10 AM
  To: MySQL forum
  Subject: Newbee Question !
 
 
 
  Dear lists members,
 
  I gonna download MySQL and PHP to install on my machine.
  But the problem is that I don't know which tarballs are required to
  do from mysql.com and php.net.
  I mean I would like to manage databases using HTML interface (MySQL/PHP).
 
  Any points or links to the web sites are highly appreciated.
 
  Thank you very much indeed.
 
  TK Tech
  (Linux Newbee)


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php