Re: [PHP] running number in paging

2006-06-29 Thread Chris

weetat wrote:

Hi all ,

 I have using PEAR:Pager , to do paging .


If you have a pear question, ask on the pear mailing list.

http://pear.php.net/support/

We do not know their code or how to use it.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] running number

2005-07-25 Thread Richard Davey
Hello Roger,

Monday, July 25, 2005, 10:21:54 AM, you wrote:

RT I am quite new at all these stuff and would like to seek your
RT advise on the *recommended way* of achieving this. I am thinking
RT along these lines:
RT a) store that number (12345) in a table
RT b) a user registers and assign that number to him
RT c) increment number to 12346
RT d) process repeats for the next registration

RT Concern: How do tell mySQL to lock the 'number' table when a
RT new registration process is about to take place. Is locking the
RT best option here or is/are there better ways?

Do you HAVE to have a starting off number of 12345? If there is no
real reason to do this, then use an auto-increment column in MySQL and
let that do all the hard work for you!

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



Re: [PHP] running number

2005-07-25 Thread Sascha Kaufmann
try mySQL's auto increment attribute

http://dev.mysql.com/doc/mysql/en/example-auto-increment.html

Roger Thomas wrote:
 I am required to write a user registration script that captures the basics 
 like name, phone number etc etc. I would also have to write to mySQL database 
 a number that is associated with that user.
 
 At this point of writing, the start of that number is unknown. But the number 
 will be incremented by 1 after each successfull registration.
 
 Let's say the number starts from 12345.
 
 I am quite new at all these stuff and would like to seek your advise on the 
 *recommended way* of achieving this. I am thinking along these lines:
 a) store that number (12345) in a table
 b) a user registers and assign that number to him
 c) increment number to 12346
 d) process repeats for the next registration
 
 Concern: How do tell mySQL to lock the 'number' table when a new registration 
 process is about to take place. Is locking the best option here or is/are 
 there better ways?
 
 Please advise.
 
 --
 Roger
 
 
 ---
 Sign Up for free Email at http://ureg.home.net.my/
 ---
 

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



Re: [PHP] running number

2005-07-25 Thread Robert Sossomon

CREATE TABLE `users` (
  `num` int(10) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL default '',
  `login` varchar(100) NOT NULL default '',
  `password` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`num`),
  KEY `num` (`num`)
) TYPE=MyISAM AUTO_INCREMENT=12345 ;

That should help out.  When creating the table in mysql you can set the 
auto_increment number on the last line, which when you add a new user the query 
looks like:


insert into users values('','name','login','pass');

leaving the first field empty makes it automatically increase it.  The beauty is 
that you can have 400 people registering at once, and their number gets 
assigned as the query is run against the database, no matter what order they hit 
it in, the system will take it as they come.


HTH,
Robert

Roger Thomas is quoted as saying on 7/25/2005 5:21 AM:

I am required to write a user registration script that captures the basics like 
name, phone number etc etc. I would also have to write to mySQL database a 
number that is associated with that user.

At this point of writing, the start of that number is unknown. But the number 
will be incremented by 1 after each successfull registration.

Let's say the number starts from 12345.

I am quite new at all these stuff and would like to seek your advise on the 
*recommended way* of achieving this. I am thinking along these lines:
a) store that number (12345) in a table
b) a user registers and assign that number to him
c) increment number to 12346
d) process repeats for the next registration

Concern: How do tell mySQL to lock the 'number' table when a new registration 
process is about to take place. Is locking the best option here or is/are there 
better ways?

Please advise.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---



--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
512 BrickHaven Drive Suite 220L, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]

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



Re: [PHP] running number

2005-07-25 Thread Roger Thomas
Thanks to all that have helped. I am inclined at Robert's suggestion below that 
would free me from worrying about locking issues. Thanks everybody.

--
Roger

Quoting Robert Sossomon [EMAIL PROTECTED]:

 CREATE TABLE `users` (
`num` int(10) NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`login` varchar(100) NOT NULL default '',
`password` varchar(20) NOT NULL default '',
PRIMARY KEY  (`num`),
KEY `num` (`num`)
 ) TYPE=MyISAM AUTO_INCREMENT=12345 ;
 
 That should help out.  When creating the table in mysql you can set the 
 auto_increment number on the last line, which when you add a new user the
 query 
 looks like:
 
 insert into users values('','name','login','pass');
 
 leaving the first field empty makes it automatically increase it.  The beauty
 is 
 that you can have 400 people registering at once, and their number
 gets 
 assigned as the query is run against the database, no matter what order they
 hit 
 it in, the system will take it as they come.
 
 HTH,
 Robert
 
 Roger Thomas is quoted as saying on 7/25/2005 5:21 AM:
  I am required to write a user registration script that captures the basics
 like name, phone number etc etc. I would also have to write to mySQL database
 a number that is associated with that user.
  
  At this point of writing, the start of that number is unknown. But the
 number will be incremented by 1 after each successfull registration.
  
  Let's say the number starts from 12345.
  
  I am quite new at all these stuff and would like to seek your advise on the
 *recommended way* of achieving this. I am thinking along these lines:
  a) store that number (12345) in a table
  b) a user registers and assign that number to him
  c) increment number to 12346
  d) process repeats for the next registration
  
  Concern: How do tell mySQL to lock the 'number' table when a new
 registration process is about to take place. Is locking the best option here
 or is/are there better ways?
  
  Please advise.
  
  --
  Roger
  
  
  ---
  Sign Up for free Email at http://ureg.home.net.my/
  ---
  
 
 -- 
 Robert Sossomon, Business and Technology Application Technician
 4-H Youth Development Department
 512 BrickHaven Drive Suite 220L, Campus Box 7606
 N.C. State University
 Raleigh NC 27695-7606
 Phone: 919/515-8474
 Fax:   919/515-7812
 [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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