Hey there,
beginner question. I count rows like this (and it's working like a charm):
How do i count columns now? My table currently looks like this:
ID
Name
AddName2
AddName3
AddName4
the thing is that the user is able to enter only a name or additional names, so code should take care of that too. The end result should be something like "There are currently x records with y additional names."
Something like IF column "Name2" NOT NULL count++ AND IF COLUMN "Name3" NOT NULL count++... - I just have no clue how to write that in PHP.
Thanks in advance
moontear
PS: I know there is the "mysql_numfields" function, but I don't know how to implement it with the Joomla special coding (e.g. $database->setQuery($sql); etc)
beginner question. I count rows like this (and it's working like a charm):
global $database; $sql = "SELECT * FROM #__chronoforms_2"; $database->setQuery($sql); $rows = $database->loadObjectList(); $cntrows = count($rows); echo "<p>There are currently <strong>".$cntrows."</strong> records.</p>
How do i count columns now? My table currently looks like this:
ID
Name
AddName2
AddName3
AddName4
the thing is that the user is able to enter only a name or additional names, so code should take care of that too. The end result should be something like "There are currently x records with y additional names."
Something like IF column "Name2" NOT NULL count++ AND IF COLUMN "Name3" NOT NULL count++... - I just have no clue how to write that in PHP.
Thanks in advance
moontear
PS: I know there is the "mysql_numfields" function, but I don't know how to implement it with the Joomla special coding (e.g. $database->setQuery($sql); etc)