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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.