Count link doesnt work

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Count link doesnt work

Post by egami » Tue Oct 16, 2012 8:01 am

mysql_fetch_array will return a numeric array unless you specify "MYSQL_ASSOC" as such.

mysql_fetch_array($query,"MYSQL_ASSOC");

otherwise, try mysql_fetch_assoc($query);

jinijames
New php-forum User
New php-forum User
Posts: 20
Joined: Fri Oct 19, 2012 4:32 am
Location: India
Contact:

Re: Count link doesnt work

Post by jinijames » Mon Nov 05, 2012 4:30 am

Try this -

<?php
$a[0] = 1;
$a[1] = 3;
$a[2] = 5;
$result = count($a);
// $result == 3

$b[0] = 7;
$b[5] = 9;
$b[10] = 11;
$result = count($b);
// $result == 3

$result = count(null);
// $result == 0

$result = count(false);
// $result == 1
?>

hire php developer | hire magento developer

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests