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. Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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++; } ?> Quote Link to comment 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. Quote Link to comment 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... Quote Link to comment Share on other sites More sharing options...
Jabop Posted July 24, 2008 Share Posted July 24, 2008 <?php if ($RecordID=='100') { // ... } ?> Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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' Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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. 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.