Page 1 of 1

Length of array

Posted: Tue Jun 21, 2005 11:12 am
by jolinar
I was wondering how you check the length of an array, either that or the posibility of using somthing that will stop looping when an array ends?

Posted: Tue Jun 21, 2005 11:14 am
by jolinar
Sorry, I'm a muppet. Just found a solution.

Code: Select all

$category_ID = $connector->query_column("SELECT category_ID FROM gallery_category");
 $category_name = $connector->query_column("SELECT category_name FROM gallery_category");
 $category_description = $connector->query_column("SELECT category_description FROM gallery_category");
 $category_URL = $connector->query_column("SELECT category_URL FROM gallery_category"); 
 $preview = $connector->query_column("SELECT category_preview FROM gallery_category");
	
 $i = 0;
 $n = sizeof($category_name);
	
 echo "<table border='1'>";
 for($i=0; $i<$n; $i++)
 {
sizeof seems to do the job fine

Posted: Tue Jun 21, 2005 11:23 am
by Burrito
yup sizeof() will work as will count()