as4s1n
New Member
- Messages
- 174
- Reaction score
- 4
- Points
- 0
I was looking at the distinct keyword in the SQL statement and I was wondering how you would get each individual columns. My guess was this:
But I'm not sure that is quite right, or there may be a better way I'm just not seeing.
PHP:
$sth = $dbh->query("SELECT distinct colName FROM table");
$i=0;
while($row=$sth->fetch()) {
$colVal.$i = $row[$i];
echo $colVal.$i;
$i++;
}
But I'm not sure that is quite right, or there may be a better way I'm just not seeing.
Last edited: