Re: fetch data from database + only the rows needed

Posted 16 July 2011 - 03:18 AM

EnvXOwner, on 16 July 2011 - 09:03 AM, said:

I suggest you do more research on mysql_query.

contrary, I suggest to research the modern (and not outdated) database classes from PHP (namely PDO and MySQLi), which have a lot more options to fetch a result (e.g. there is a method to fetch a column’s value directly)

Re: fetch data from database + only the rows needed

I have a problem , do anybody know how to fetch data only the we needed.

If I explain this further,

I wanted to fetch data from usercomments table's 3rd row data then how can i get it?

plz reply,
thx in advance menuka.

If I understand you properly, I'd think you want to achieve this:

SELECT whatever column(s) FROM usercomments table
...
LIMIT 2,1;

The LIMIT <offset> <number of rows to return> clause is suited for such operations. It tells MySQL to begin its querying from <offset>th(0(zero) is the first row) row and return a particular number of rows indicated by <number of rows to return>.

So the above code will start querying at the third row and return only that row i.e 1 row. Then you can get whatever data you want from that row. Is this what you intended?

No offence but (If I was right about the proffered solution) your question seems a little fundamental concepts-based, so I suggest you take some time to go over such concepts again(2 weeks maybe) for all the languages and tools you use for development and you won't regret you did.