Each time I learn something new related to PHP/MySQL/CSS/Javascript, I will post it here.
Generating previous and next buttons for a none sequential DB, using an auto-incremential primary key:
Why is this important do you ask? Because sometimes when you run a database, even if you have an auto-incrementing primary key, sometimes records get deleted for whatever reason leaving gaps between id records. Ex. You have 10 records in your database, the identifier key spans 1-10. You delete record 5. Now visit record 4, and when you click the next button, it selects record 5. As we know we just deleted this record...uh-oh. It really should be skipping to record 6. Now I go and visit record 6, I hit previous... uh-oh, another broken end. This query will select only the next possible record, sequentially (based on ithe primary auto-increment identifier). Even if gap in sequence exists, it will skip on to the next possible record.
Generating previous and next buttons for a none sequential DB, using an auto-incremential primary key:
SELECT * FROM table WHERE field_id<>2 ORDER BY field_id LIMIT 2;
Why is this important do you ask? Because sometimes when you run a database, even if you have an auto-incrementing primary key, sometimes records get deleted for whatever reason leaving gaps between id records. Ex. You have 10 records in your database, the identifier key spans 1-10. You delete record 5. Now visit record 4, and when you click the next button, it selects record 5. As we know we just deleted this record...uh-oh. It really should be skipping to record 6. Now I go and visit record 6, I hit previous... uh-oh, another broken end. This query will select only the next possible record, sequentially (based on ithe primary auto-increment identifier). Even if gap in sequence exists, it will skip on to the next possible record.
Wow.. This might come in handy since I'm gonna take CompSci...
Neat Fuse! Your the best!!!
Neat Fuse! Your the best!!!
huh
i took web design but not really far..... just basic and some flash
and i dont have any idea of what u typed lol

i took web design but not really far..... just basic and some flash
and i dont have any idea of what u typed lol


nice info fuse!!!
btw what does .dll mean?
btw what does .dll mean?
Only a dead fish goes with the flow
<a href="http://genshu.shogunwars.com/register.php?commander=HamsterLord"> <img src="http://genshu.shogunwars.com/badge.php?user=HamsterLord" width="440" height="100" border="0"> </a>
<a href="http://genshu.shogunwars.com/register.php?commander=HamsterLord"> <img src="http://genshu.shogunwars.com/badge.php?user=HamsterLord" width="440" height="100" border="0"> </a>
dll are dynamic link libraries. It's windows way of adding functionality to programs. Such as a graphical users dll would control the generation of the visual layout of a program. So when a programmer comes around they don't need to write their own, but instead can use it. Saves time and energy so programmers can invest more time into more robust features for their programs.
That is just one application.
That is just one application.
You must login or create an account to reply to a topic.