alpha02 Posted March 5, 2006 Share Posted March 5, 2006 Hello!I want to make a function to return the row number. Example:table: orders|_____ID_____|_________NAME__________||_____4______|______NOBODY__________||_____3______|_______NONE____________||_____5______|_______NONAME__________||_____2______|_______NOBODY__________|something like:$resource = mysql_query ("SELECT * FROM orders WHERE id = '5'");$rownum = getrownum ($resource);echo $rownum; //write 2I need this for my forum, please help! Link to comment Share on other sites More sharing options...
aspnetguy Posted March 6, 2006 Share Posted March 6, 2006 Hello!I want to make a function to return the row number. Example:table: orders|_____ID_____|_________NAME__________||_____4______|______NOBODY__________||_____3______|_______NONE____________||_____5______|_______NONAME__________||_____2______|_______NOBODY__________|something like:$resource = mysql_query ("SELECT * FROM orders WHERE id = '5'");$rownum = getrownum ($resource);echo $rownum; //write 2I need this for my forum, please help! <{POST_SNAPBACK}> $rownum = 0;$i = 0;$resource = mysql_query ("SELECT * FROM orders");$numberOfRecords = mysql_numrows($resource);while($i < $numberOfRecords){ if(mysql_result($resource,$i,'id') == '5'); $rownum = $i; $i++;} Link to comment Share on other sites More sharing options...
alpha02 Posted September 6, 2017 Author Share Posted September 6, 2017 Thanks, fixed it now! Link to comment Share on other sites More sharing options...
justsomeguy Posted September 6, 2017 Share Posted September 6, 2017 11 years later, that's probably a record. Link to comment Share on other sites More sharing options...
alpha02 Posted September 6, 2017 Author Share Posted September 6, 2017 7 hours ago, justsomeguy said: 11 years later, that's probably a record. I take pride in what I do. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now