I have a query that looks like this:
$sql = "SELECT s.emp_id, s.f_name as source_first, s.l_name as source_last, s.src_id, u.f_name as owner_first, u.l_name as owner_last FROM src_main s LEFT JOIN users u ON s.emp_id = u.emp_id";
I have tested it on the command line and it returns the expected results.
After the query, I do a couple of things:
$result = mysql_query($sql);
$my_source = mysql_fetch_assoc($result);
stripslashes_array( $my_source );
$my_array_count = count( $my_source );
Now at this stage if I put in an echo and print out a value such as: $my_source[emp_id], I will get a valid value from the datbase.
HOWEVER, if I enter a foreach loop (which I am use to using many, many times now with success) - I get strange results where each field has a pair of letters in it like "GG" or "HH" or whatever...
The very next part of my PHP looks like this, and this is where things go nuty:
foreach ( $my_source as $my_row ) {
# So down in here if I try to access a variable as $my_row[emp_id] it will be all messed up!!??
Any ideas where I'm going wrong with this?