I still didn't get what you meant, but the last post is warming it up . . . I am going with two "possible assumptions." The first is that you are accessing just db fields, and might be doing so incorrectly. Example:
id|title|whatever
1|test|this is a test
$query = "select * from table";
$result = mysql_query($result);
while ($row=mysql_fetchrow_array($result)) {
echo $row['id'] . " " . $row['title'] . " " . $row['whatever'] . "<br>\n";
}
Note that the field names are used to access the array $row, which can be either an associative array or an indexed array. You will get the
exact same results with this: ARGH. Can't show you this due to recent updates on this board that cause this to BREAK. Where you see THIS
[
0
]
These go all on one line. echo $row
[
0
]
. " " . $row
[
1
] . " " . $row
[
2
] . "<br>\n";
If that's the issue, great. Otherwise, the previous . . .
the Column remarks has a different letter value in each field
leads me to think, you have a delimited string in a single database field, something like
($row['whatever'])
foo|fee|fi|fo|fum
or
foo,fee,fi,fo,fum
Is that correct? Before I go further, note that this is **always** a bad idea for various reasons, the primary one being is makes the easy search tools of mySQL very complicated. Second, it's seldom an efficient way to store the data in question. These should be stores in individual fields, so put that in your toolbox and maybe re-think it.
If the above is true, here is likely what your solution is. I don't know exactly what your delimiter is, so swap | for whatever that is.
Note also, I don't know how many "fields" are in your database field, so I've implemented a loop to go through them. Hopefully not more than 26. :-)
<?php
// an array of the KEYS
$keys = Array('A','B','C','D','E','F','G','H','I','J','K',
'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
//
$delim_data=$out=NULL;
$query = "select some-field from table";
$result = mysql_query($result);
// Only one field - index 0 does fine, but this board BREAKS it
while ($row=mysql_fetchrow_array($result)) {
$delim_data = explode('|',$row['whatever']);
for ($i=0;$i<count($delim_data);$i++) {
$keys[$i] = $delim_data[$i];
}
}
if ($delim_data) {
$out = '<table><tr>';
foreach ($delim_data as $key => $value) {
$out .= "<td> Key: $key Value: $value </td>";
}
$out .= '</tr></table>';
}
else { $out = '<p>No records to display</p>'; }
echo $out;
?>
The reason I'm confused is you mentioned a field that contains fields, and used 'REMARKS' in your first example, 'STATUS_CODE' in your second. So is one onf these even close?