Jump to content

Retrieving 15 values in descending order starting from last updated? need help


adamrg7

Recommended Posts

Hey everyone, I am new to the forum and its good to see a place to come for help.. I wouldn't say that I am a very experienced php/mysql programmer. I have more experience in c++, and I am just getting my hands dirty with php.. I need a little help retrieving some values, this is what I have so far, which it keeps giving me the same value 15 times for each userid:

 

for ($counter=0; $counter<$totalAssets; $counter+=1)

{

  for($counter2=0; $counter2<=15; $counter2+=1)

  {

$longitudes_L = mysql_query("SELECT longitude FROM tbl_transactions where userid= '$assets[$counter]' ORDER BY tid DESC", $mysql_link);

  $theresult = mysql_fetch_row($longitudes_L);

  $longitudes[$counter][$counter] = $theresult[0];

  echo $longitudes[$counter][$counter2];

    }

}

 

Basically what im trying to do is get 15 of the last longitudes posted to the server, and put it into a multi dimensional array where the $longitudes[//THIS IS THE USER ID][//15 LONGITUDES go in here]

 

Thanks..

-Adam

 

Sorry, i accidentally posted before i was done the message because i pressed TAB, and hit enter, which hit post.

 

I modified the code, and there is mysql in there, hopefully you can help me out here with the best way to retrieve this data..

thanks

  • 2 weeks later...

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.