Search Webmaster Help and Solution

Find Match in MySQL Table

Ok, so it sounds easy, and I thought I knew this, but I have searched and searched and realize my brain has taken holiday. Im basically an idiot.

So, heres what I am doing. . .

I have a table with several fields (id, company, city, and others). What I think I want to do is to select all the records (ordering by company asc for display purposes) and loop through them to find the requested id, BUT then I need to know the current row that match occurs in the overall list.

If I am not mistaken, if I do the match on the id in the table with the id requested, then only that one row will be selected. So then for getting the prev/next links to work off the ordered by company asc order and not just the id sort, I need to know where this particular id matched row is in the overall list.

(I dont think I am explaining this well, but you folks are smart enough to interpret, I know.)

I have done several searches and read the FAQs, honest. I am sure someone will tell me that Im an idiot, apparently the coffee isnt helping.

Thanks so much!

-John Ok, so it sounds easy, and I thought I knew this, but I have searched and searched and realize my brain has taken holiday. Im basically an idiot.

So, heres what I am doing. . .

I have a table with several fields (id, company, city, and others). What I think I want to do is to select all the records (ordering by company asc for display purposes) and loop through them to find the requested id, BUT then I need to know the current row that match occurs in the overall list.

If I am not mistaken, if I do the match on the id in the table with the id requested, then only that one row will be selected. So then for getting the prev/next links to work off the ordered by company asc order and not just the id sort, I need to know where this particular id matched row is in the overall list.

(I dont think I am explaining this well, but you folks are smart enough to interpret, I know.)

I have done several searches and read the FAQs, honest. I am sure someone will tell me that Im an idiot, apparently the coffee isnt helping.

Thanks so much!

-John

View Complete Thread with Replies

Related Items

Query failed: connection to localhost:3354 failed (errno=111, msg=Connection refused).