• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need Help With Exploding CSV Data Within DB

#17
[eluser]Jay Logan[/eluser]
clean_result is this function that was used on one of my other sites. Another programmer made it and it was the only way I knew to get the result to display in my view correctly using code like:

Code:
<? foreach ($counties as $row): ?>
    <li>&lt;?= $row['County']['county_name'] ?&gt;</li>
&lt;? endforeach; ?&gt;

Here is the function.

Code:
function clean_result(&$ci_result)
        {
            $result = $ci_result->result_id;
            $array = array();
            $row = 0;
            while ($values = mysql_fetch_array($result, MYSQL_NUM))
            {
                for ($i=0; $i<mysql_num_fields($result); $i++)
                {
                    $meta = mysql_fetch_field($result, $i);
                    if ($meta->table != '')
                    $array[$row][$meta->table][$meta->name] = $values[$i];
                    else
                    $array[$row]['as'][$meta->name] = $values[$i];
                }
                $row++;
            }
            return $array;
        }

I'll try out free_result.


Messages In This Thread
Need Help With Exploding CSV Data Within DB - by El Forum - 02-12-2009, 03:54 PM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-12-2009, 05:16 PM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-12-2009, 05:22 PM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 07:23 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 07:30 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 07:38 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 08:02 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 08:08 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 08:11 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 08:15 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 08:25 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 08:32 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 09:12 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 09:29 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 10:40 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 10:46 AM
Need Help With Exploding CSV Data Within DB - by El Forum - 02-13-2009, 11:12 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.