Jump to content

Array Help


inspireddesign

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/153953-array-help/
Share on other sites

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'];
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/153953-array-help/#findComment-809132
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.