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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...
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.