How to export some rows of a MySQL table from a WHERE clause?
In very simply way go to your phpMyAdmin select you database whose particular rows you want to export click on "SQL" (To Run SQL query/queries on database) Write sql query and execute it Like select * from test table limit 500 now what ever result come Just at the bottom see "Query results operations" just click on Export
All done :-)
As mentioned in the comments you can use mysqldump the following way.
mysqldump --user=... --password=... --host=... DB_NAME --where=<YOUR CLAUSE> > /path/to/output/file.sql
If you want this to be in your php file you can do the following
exec('mysqldump --user=... --password=... --host=... DB_NAME --where=<YOUR CLAUSE> > /path/to/output/file.sql');
Mysql Shell command
mysqldump -u user -p password -h host Database Table --where="Condition"> /path/exportFile.sql
Example
mysqldump -u user -p 123456 -h host Database Student --where="age > 10"> /path/exportFile.sql