- Forums
- MYSQL
- Mysql Query Between Row In A Table
if you have got a php website from us, you know your plan comes included with a you can use mysql to do many great things for your website. today we are going to show you how you can query your database when you need to get in between your rows in a table [2330], Last Updated: Mon Jun 24, 2024
Webune Support
Thu Oct 14, 2010
0 Comments
686 Visits
Welcome to Webune forums.
We provide LAMP and XAMP hosting.
if you have got a PHP website from us, you know your plan comes included with a database.
you can use mysql to do many great things for your website. Today we are going to show you how you can query your database when you need to get in between your rows in a table
lets say for example i have this table
id | username | password |
1 | example88 | ******* |
2 | stewymo | ******** |
3 | darlin90 | ***** |
4 | tornni | **** |
5 | xcelnn | ********* |
6 | myuser__00 | ********** |
as you can see from my table, i have 6 entries in my users table, but i only want to get all the entries between 2 and 5, well its easy i will show you how, you can use the query as an example
PHP CODE:
$sql = "SELECT * FROM UsersTable WHERE id BETWEEN 2 AND 5";
you can also use it for updating:
PHP CODE:
$sql = "UPDATE UsersTable SET username 'whatever' WHERE id BETWEEN 2 AND 5";
or you can use to delete.. well, you get the idea
hope that helps