Skip to main content

Select previous and next row from a Mysql table

Previous ID:
SELECT id FROM $mytable WHERE id < $id ORDER BY ID DESC LIMIT 1;
Next ID:
SELECT id FROM $mytable WHERE id > $id ORDER BY ID ASC LIMIT 1;
(thanks to Bob Field)

Comments

Popular posts from this blog

Open source libraries and trading systems review

In this post I reviewed some of the most important trading systems and financial librarys on the net. SFL Java Trading System Enviroment http://sourceforge.net/projects/sfljtse http://www.sflweb.org/index.php?blog=sfljtse The SFL Java Trading System Enviroment is a java application built on KISS principle (Keep It Simple,Stupid) and its aim is to provide a fast and platform indipendent infrastructure to develop and execute trading Systems. EclipseTrade http://sourceforge.net/projects/eclipsetrader/ http://eclipsetrader.sourceforge.net/ Stock exchange analysis system, featuring shares pricing watch, intraday and history charts with technical analysis indicators, level II/market depth view, news watching, automated trading systems, integrated trading. Based on Eclipse RCP framework. JsystemTrader http://code.google.com/p/jsystemtrader/ JSystemTrader is a fully automated trading system (ATS) that can trade various types of market securities during the trading day without user mo...

Best chart libraries

Charts are an indispensable part of any data visualization work. People can grok visual representation of data easily than a textual variety. Today there are a huge number of free chart libraries available to display visualizations on websites. Below is a small list of  some of the libraries available for displaying charts using php. pChart - a PHP class to build charts pChart is a PHP class oriented framework designed to create aliased charts. Most of todays chart libraries have a cost, our project is intended to be free. Data can be retrieved from SQL queries, CSV files, or manually provided. This project is still under development and new features or fix are made every week. Focus has been put on rendering quality introducing an aliasing algorithm to draw eye candy graphics. Rendering speed has been dramatically enhanced since the first version, we'll still continue optimising the code!  JpGraph   JpGraph is an Object-Oriented Graph creating library for PHP ...