...

View Full Version : Resolved CodeIgniter Help!!



tkaeer
02-28-2010, 12:24 AM
Hey, I have made a Comment system on my blog, and I would like to make a function that says "No comments yet, be the first!" if there are no rows on a specific post.

I've tried different ways with num_rows but I'm not sure where to put it or how etc.


/Please help Tkaeer :p

masterofollies
02-28-2010, 12:26 AM
if (mysql_num_rows($query)) == '0') {
//No comments yet
}
else {
//Comments exist you aren't the first
}

tkaeer
02-28-2010, 01:16 AM
if (mysql_num_rows($query)) == '0') {
//No comments yet
}
else {
//Comments exist you aren't the first
}

Thanks for your answer but I fixed it with another solution.

My solution:
I put the code directly in my view file, stupid I'm :p


<?php
$this->db->where('ID', $this->uri->segment(3));
$query= $this->db->get('comments');
if($query->num_rows == 0){

echo "No comments yet, Be the first!";
}
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum