Re: Re: Incremental Date Based ID

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

 




hello there,

i had to deal with such an issue for labeling job-tickets -–
(yymmdd.nn)

so maybe try this...

<code>

// today‘s date : "yymmdd"
$use_akt_Datum = date("ymd");

// how many jobs (artikels) are there today ?
$HeutigeAuftraegeSQL = "SELECT * FROM auftrag WHERE Auftragsnummer LIKE
'".$use_akt_Datum."%' ORDER BY Auftragsnummer ASC;";
$mySQL_Link->query($HeutigeAuftraegeSQL);
for ($ai = 0; $ai < $mySQL_Link->rows; $ai++) {
   $ANs[$ai] = $mySQL_Link->fetch($ai);
}
$at = explode(".", $ANs[$ai-1]["Auftragsnummer"],2); // this gets the
last sub-id
$aktuellerAuftrag = $at[1] + 1;  // incr last sub-id

// build new job(article)-id
$aktuelleAuftragsNR = $use_akt_Datum.".".sprintf("%02d",
$aktuellerAuftrag);

// check if this new id might allready exists...
......
....
..
</code>

hope that helps...
bb

>At 05:05 PM 3/7/2006, Kevin Murphy wrote:
>>Well, part of the issue is that I want to be able to use this as part
>>of the link:
>>
>>/news.php?article=2006-03-05a
>>/news.php?article=2006-03-05b
>
>
>With respect, I too think you should re-examine your reasons for
>wanting to number (or letter) the links consecutively in the database.
>
>To whom does the spelling of an URL really matter? I believe that
>website visitors rarely care; they care about how things are labelled
>in the foreground and they want to get to the correct page, but I
>don't think many people really study the details of the address bar
>and even fewer make judgements about the quality or completeness of
>website content on that basis.
>
>There are in fact solid reasons for NOT changing URLs once they're
>established -- for example, the persistence of bookmarks, links from
>other websites, and search engine memory. Once you establish an URL
>pointing to a particular page it's going to be recorded, stored, and
>repeated by many other entities on the internet. If you're
>whimsically changing URLs at random intervals, old URLs will no
>longer point to the same content. You'll be doing your own material
>a disservice by frustrating one of the most powerful assets the
>internet can lend you: its persistence of vision.
>
>I wonder if your desire for contiguously lettered URLs can be
>satisfied by simply assigning consecutive letters to the display text
>that links to the articles:
>
>HTML:
><ol>
><li><a href="/news.php?article=9568367">Title of article</a></li>
><li><a href="/news.php?article=1937452">Title of article</a></li>
><li><a href="/news.php?article=4694832">Title of article</a></li>
>
>CSS:
>ol
>{
>list-style-type: lower-alpha;
>}
>
>RESULT:
>a. Title of article
>b. Title of article
>c. Title of article
>
>As others have pointed out, the sequence in which the URLs spill out
>from the database can be controlled by a timestamp in each
>record. The lettering of the articles a-z can be controlled by the
>ordered list for the benefit of the visitor. When an article is
>inserted into or deleted from the list, the list retains its
>contiguity IN THE PRESENTATION and you aren't put in the inelegant
>position of trying to renumber records in a database.
>
>Regards,
>Paul
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Björn Bartels
-Development/IT-Services-

----------------------------------------------
dbusiness.de gmbh
digital business & printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
info@xxxxxxxxxxxx
ftp://dbusiness.dyndns.org


Björn Bartels
-Development/IT-Services-

----------------------------------------------
dbusiness.de gmbh
digital business & printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
info@xxxxxxxxxxxx
ftp://dbusiness.dyndns.org

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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux