Tandem Posted September 4, 2006 Share Posted September 4, 2006 Is there anyway to specifiy a certain row number for mysql_fetch_array? Or do i need a different function all together? Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/ Share on other sites More sharing options...
marker5a Posted September 4, 2006 Share Posted September 4, 2006 I was faced with this dilemna a long time ago... put in an 'id' field in MySQL (assuming you meant you want to only pull a row from MySQL DB)Call the query[code]$query = mysql_query( "SELECT * FROM `table_name` WHERE id = 'some id'" );[/code]Let us know if that helps Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/#findComment-85526 Share on other sites More sharing options...
Tandem Posted September 4, 2006 Author Share Posted September 4, 2006 Thanks for the reply.Thats not what i meant, i probably should have gone into more detail, sorry about that :PI'm using a for loop to pull multiple rows from a table and display them in order, via Select * from....etc. But now i need to start the process from a certain row. Is there any way to do that? Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/#findComment-85528 Share on other sites More sharing options...
extrovertive Posted September 4, 2006 Share Posted September 4, 2006 Ya, look into LIMITSELECT * FROM table LIMIT (the row, 1) Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/#findComment-85530 Share on other sites More sharing options...
marker5a Posted September 4, 2006 Share Posted September 4, 2006 Ahhhhhhh, yes... place this after your order by statement in the query...[code]LIMIT OFFSET offest_row[/code]http://dev.mysql.com/doc/refman/5.0/en/select.html Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/#findComment-85531 Share on other sites More sharing options...
marker5a Posted September 4, 2006 Share Posted September 4, 2006 Sorry, since you are limiting to 1 row, go with what extrovertive said, but be sure to check out MySQL's page for help on that kinda stuff, they are very in depth with it. Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/#findComment-85533 Share on other sites More sharing options...
Tandem Posted September 4, 2006 Author Share Posted September 4, 2006 I think you are both misunderstanding me. I'm gonna go into way more depth so you can get more of an uderstanding of where i'm coming from. Sorry for not just doing that in the first place.Ok. A few months ago i made a message board/forum. I'm now currently trying to make it so that the number of topics displayed on a single page is limited.To display the topics i use (This is very simplified from the real thing):[code]$get_topic_details = mysql_query("SELECT * FROM FORUM");for ($i = 0 ; $i < $number_of_topics ; $i++) {$topic_details = mysql_fetch_array($get_topic_details);echo "$topic_details[1]";}[/code]This cycles through the rows., and echo's $topic_details[1] which would be the title or something. But now i want to create different pages showing the topics that have fallen below the top 30, showing 30 topics per page. I want to be able to start the mysql_fetch_array at row 30, or or any other number i may need to start it at. How would i go about this. Please say if you need more detail. Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/#findComment-85536 Share on other sites More sharing options...
.josh Posted September 4, 2006 Share Posted September 4, 2006 it's called pagination. do a search on that keyword. lots of posts and tutorials here about it. Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/#findComment-85537 Share on other sites More sharing options...
extrovertive Posted September 4, 2006 Share Posted September 4, 2006 Ya, paginiation deals with manipulation of LIMIT in mysql. Quote Link to comment https://forums.phpfreaks.com/topic/19636-mysql_fetch_array/#findComment-85539 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.