knowram Posted March 25, 2010 Share Posted March 25, 2010 I am not sure if this question belongs in the mysql section or not so if it does forgive me. Say I have the following table: PID Action Hardware Set Dialplan 14 I test-HS-2 test2 14 I test-HS-1 TestDialpl 14 I test-HS-2 test3 I would like to select the second time PID = 14. Quote Link to comment Share on other sites More sharing options...
alberrambo Posted March 25, 2010 Share Posted March 25, 2010 please tell about the thing you want and i will do my best to solve it Quote Link to comment Share on other sites More sharing options...
knowram Posted March 25, 2010 Author Share Posted March 25, 2010 So I know I can do the following. Say the Table name is Tabs $Tab = mysql_query("SELECT * from `Tabs` WHERE PID = '14'"); $Tab = mysql_fetch_array($Tab, MYSQL_ASSOC); And it will return first row in the table where PID = 14 or $result = mysql_query("select * from `Tabs` where PID = '14' ") or die ("nope"); while ($Tab = mysql_fetch_array($result, MYSQL_ASSOC)){ print_r($Tab); } and that will print all rows where PID = 14. What I am trying to do is just get the content of the second row where PID = 14. Quote Link to comment Share on other sites More sharing options...
irkevin Posted March 25, 2010 Share Posted March 25, 2010 if i understand, you need this line 14 I test-HS-1 TestDialpl You might want to try $Tab = mysql_query("SELECT * from `Tabs` WHERE PID = '14' AND hardware = ' test-HS-1'"); But this is not a good approach. You need a unique ID in your table.. Like +---++---++-------++------------+ | ID | PID| |action| |Hardware| +---++---++-------++------------+ | 1 | 14 | | 2 | 14 | | 3 | 14 | | 4 | 14 | And so on Then $Tab = mysql_query("SELECT * from `Tabs` WHERE ID = '2'"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.