inspireddesign Posted April 14, 2009 Share Posted April 14, 2009 Hello all, Well here's my real problem. I would like the output to be "Aircaft1 Data Chuck", "Aircaft2 Data Chuck", "Aircaft3 Data Chuck", etc. SELECT * FROM `aircraft` WHERE client_id = 100; So with the id of 100 from aircraft table above I have three rows of data and would like my output to be: $row1 = (All data from first row) $row2 = (All data from second row) $row3 = (All data from third row) I'm trying a loop using mysql_fetch_assoc but can't seem to get the data to output correctly. Currently the data is just dumped into one array with all three rows but I would like it to loop where it puts the first row of data into a usable array then puts the next row into another data collection array and so on until there are no more rows of data to pass. Can someone help? Thanks a bunch, Damian Quote Link to comment https://forums.phpfreaks.com/topic/153953-array-help/ Share on other sites More sharing options...
Maq Posted April 14, 2009 Share Posted April 14, 2009 I'm trying a loop using mysql_fetch_assoc but can't seem to get the data to output correctly. Sounds like you're on the right track and if you provided some code we could tell you what you need to modify. Something like: $sql = "SELECT * FROM `aircraft`WHERE client_id = 100"; $result = mysql_query($sql) or die(mysql_error()); while($row = msyql_fetch_assoc($result)) { echo $row['row1'] . " " . $row['row2'] . " " . $row['row3']; } Quote Link to comment https://forums.phpfreaks.com/topic/153953-array-help/#findComment-809132 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.