Re: auto-generating next id (in order) for an add script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Depending on your version of MySQL, table type should be MyISAM so that numbers for deleted articles do not get reused.
Miles Thompson

At 02:33 PM 6/20/2005, tramelw@xxxxxxx wrote:
Thanks Bastien,

I am off to try the auto increment. I will post back if I cannot get it to work properly.


Again, thanks everyone.


-----Original Message-----
From: Bastien Koert <bastien_k@xxxxxxxxxxx>
To: tramelw@xxxxxxx; php-db@xxxxxxxxxxxxx
Sent: Mon, 20 Jun 2005 13:30:13 -0400
Subject: RE:  auto-generating next id (in order) for an add script

post your code and db structure, it might be simpler to use an auto increment value and let the db do the work in assigning the next number...

bastien

>From: tramelw@xxxxxxx
>To: php-db@xxxxxxxxxxxxx
 >Subject:  auto-generating next id (in order) for an add script
>Date: Mon, 20 Jun 2005 12:54:20 -0400
>
>Hello,
>
>I have a site that allows reporters to enter their articles into a forum. I >am then spilling their articles onto the main page from a MySQL dbase via a >php script, read "LATEST ARTICLES".
>
>I am now entering the data myself after they email it to me, however this >is becoming more of a task I dont' have time for as the number of articles >increase per day.
>
>Right now, I have an addarticle.php page where they can enter their >information. I have ran a test of this script, and it works great. However, >I have been entering the PHP IDs myself in ascending order (i.e. 0005, >0006, 0007) because I can see all of the articles.
>
>The reporters however are not able to see these articles, and instead of >having them enter a random php ID, I'd like my add script to check for the >last ID entered and then enter the number above (i.e.... add row to table, >check PHP ID, if 0007 is last row entered, enter 0008 for php ID for new >article).
>
>Does anyone know how to add this particular command to a page, and if so, >where?
>
>
>Thank you in advance.
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>




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


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux