coder9 Posted July 24, 2008 Share Posted July 24, 2008 hello How do i know if the record reach 100? how? thank you in advance. Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/ Share on other sites More sharing options...
DarkWater Posted July 24, 2008 Share Posted July 24, 2008 Sorry, I broke my crystal ball and it's still in the shop. Mind elaborating? Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598612 Share on other sites More sharing options...
coder9 Posted July 24, 2008 Author Share Posted July 24, 2008 come on man. i know this is easy. my brain is parking. lol Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598616 Share on other sites More sharing options...
DarkWater Posted July 24, 2008 Share Posted July 24, 2008 Yeah, but I have NO idea what you're talking about. Are you talking about an auto incrementing primary key? Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598617 Share on other sites More sharing options...
revraz Posted July 24, 2008 Share Posted July 24, 2008 IF (record == 100) That's my best guess since you are bascially telling us nothing. Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598618 Share on other sites More sharing options...
coder9 Posted July 24, 2008 Author Share Posted July 24, 2008 yeah lets just assume that a table has an incrementing id. just imagine a dummy table. Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598625 Share on other sites More sharing options...
DarkWater Posted July 24, 2008 Share Posted July 24, 2008 Still not being specific. Are you inserting something and want to see if that ID is 100? Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598628 Share on other sites More sharing options...
Jabop Posted July 24, 2008 Share Posted July 24, 2008 <?php for($i=1; $i <= 100; $i) { echo $i; } while($i<100) { // ... stuff $i++; } ?> Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598630 Share on other sites More sharing options...
coder9 Posted July 24, 2008 Author Share Posted July 24, 2008 <?php for($i=1; $i <= 100; $i) { echo $i; } while($i<100) { // ... stuff $i++; } ?> thanks man. but how does the code know that it reach 100 record already? where is the mysql command? thank you. Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598641 Share on other sites More sharing options...
DarkWater Posted July 24, 2008 Share Posted July 24, 2008 He was being sarcastic because you provided no information whatsoever. Please explain what you're trying to do... Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598643 Share on other sites More sharing options...
Jabop Posted July 24, 2008 Share Posted July 24, 2008 <?php if ($RecordID=='100') { // ... } ?> Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598644 Share on other sites More sharing options...
coder9 Posted July 24, 2008 Author Share Posted July 24, 2008 ah i know now thanks do my stupid brain lol Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598657 Share on other sites More sharing options...
coder9 Posted July 24, 2008 Author Share Posted July 24, 2008 oh, my stupid brain doesn't figured it out. actually i just want to count the total records (not the column but the row) inside the table. as simple as that. i don't want to rely on id since this id is not reliable, since it is possible to delete a record and the id number still stay on that number and increment. there must be another way to do this. thank you. Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598673 Share on other sites More sharing options...
coder9 Posted July 24, 2008 Author Share Posted July 24, 2008 i think this will help SELECT count( * ) as total_record FROM `student` what do you think guys? Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598677 Share on other sites More sharing options...
Jabop Posted July 24, 2008 Share Posted July 24, 2008 SELECT COUNT(ID) FROM student WHERE class='four' Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598683 Share on other sites More sharing options...
coder9 Posted July 24, 2008 Author Share Posted July 24, 2008 SELECT COUNT(ID) FROM student WHERE class='four' thanks man i should maybe count the id and exclude the where. since only the total number of the records is what i want. thank you. Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598686 Share on other sites More sharing options...
Jabop Posted July 24, 2008 Share Posted July 24, 2008 In that case, I tend to do SELECT COUNT(ID) FROM student WHERE ID!='' Just for safety measures, and by habit. Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598691 Share on other sites More sharing options...
coder9 Posted July 24, 2008 Author Share Posted July 24, 2008 by the way how do i store now the value of count(id) into the variable --> $total_rec thank you. Link to comment https://forums.phpfreaks.com/topic/116410-how-do-i-know-if-the-record-reach-100/#findComment-598692 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.