Welcome Guest, Not a member yet? Register   Sign In
Need Help With Exploding CSV Data Within DB
#7

[eluser]TheFuzzy0ne[/eluser]
Well, I don't see why you can't do it in two queries. The first query can get the column with the CSV numbers, and the second would get all rows with the specified IDs.

Code:
// Get the IDs from the table.
$this->db->where('zip_code', $zip_code);
$result = $this->db->get('my_table');

if ($result->num_rows() != 1)
{
    // Entry doesn't exist, or there are more than one row for that entry.
}
else
{
    // Explode the ids into an array.
    $ids = explode(",", $result->row()->ids);

    // Iterate through the exploded IDs, and use supply them to $this->db->or_where()
    foreach ($ids as $id)
    {
        $this->db->or_where('id', $id);
    }
    
    $result = $this->db->get('my_other_table');

    // Do something with the resulting rows.    
}
The above code is untested and designed to work with imaginary tables.

Hopefully it should help illustrate what you might need to do.


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



Theme © iAndrew 2016 - Forum software by © MyBB