h3ktlk Posted May 22, 2007 Share Posted May 22, 2007 Is it possible to echo a specific record in a MySQL table based on its ID column? Im newer to all this, using php and mysql.. have table with about 50 rows of data, im trying to pull one field from say row 20 and put it in one section of the website, then trying to grab a field from row 42 and put somwhere else. Been killing myself trying to echo a certain row or setup querys to let me do such. Help please! Quote Link to comment https://forums.phpfreaks.com/topic/52496-need-help-with-grabbing-data/ Share on other sites More sharing options...
gloeilamp Posted May 22, 2007 Share Posted May 22, 2007 With "LIMIT 42" you can select a certain row if I'm not mistaking.. Check out the Cheat Sheet @ http://www.ilovejackdaniels.com/mysql_cheat_sheet.png And check out the bottom one from the queries. Quote Link to comment https://forums.phpfreaks.com/topic/52496-need-help-with-grabbing-data/#findComment-259036 Share on other sites More sharing options...
h3ktlk Posted May 22, 2007 Author Share Posted May 22, 2007 mysql_select_db($database_sum_enrich, $sum_enrich); $query_EventSession1K = "SELECT EventName FROM eventssession1 WHERE GradeK = 'yes' LIMIT 8"; $EventSession1K = mysql_query($query_EventSession1K, $sum_enrich) or die(mysql_error()); $row_EventSession1K = mysql_fetch_assoc($EventSession1K); $totalRows_EventSession1K = mysql_num_rows($EventSession1K); heres some of my code... what would i place in echo to get it to get the output. Quote Link to comment https://forums.phpfreaks.com/topic/52496-need-help-with-grabbing-data/#findComment-259039 Share on other sites More sharing options...
bubblegum.anarchy Posted May 22, 2007 Share Posted May 22, 2007 Adding the following to the end of a query returns that record: LIMIT 42, 1 In the above query, 42 represents the starting position and 1 represent the amount of records to return. Quote Link to comment https://forums.phpfreaks.com/topic/52496-need-help-with-grabbing-data/#findComment-259367 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.