chop Posted March 17, 2012 Share Posted March 17, 2012 Here is a script that I typed into php MyAdmin: SELECT M.media_name FROM media as M INNER JOIN member_media as J on J.mediaID = M.mediaID WHERE J.maaMemberId = 209 The number of rows it returns is 3 Here is the php version: $q = "SELECT M.media_name FROM media as M INNER JOIN member_media as J on J.mediaID = M.mediaID WHERE J.maaMemberId = 209"; $r = @mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); $row = mysqli_fetch_array ($r, MYSQLI_NUM); echo $row[0]; echo $row[1]; echo $row[2]; exit(); The only result is $row[0] which is a correct result (matches first row in first example) The other 2 rows give "Undefined offset" Link to comment Share on other sites More sharing options...
chop Posted March 17, 2012 Author Share Posted March 17, 2012 I guess I've been working with ASSOC arrays too long. It seems that the entire results of the SELECT is given within a single array $row[0]. I was thinking that the 3 results were equal to 3 separate rows so that it would be stored in $row[0], $row[1],$row[2]. But it's not, it's all a single row of results.. right? Hmmm, okay, you have my permission to change my "Advanced Member" status to "Advanced Dementia". Link to comment Share on other sites More sharing options...
Larry Posted March 19, 2012 Share Posted March 19, 2012 Right. It's three rows with one value in each. Link to comment Share on other sites More sharing options...
Recommended Posts