PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$result = mysql_query("Select subscriberid from SendStudio_list_subscribers where formid=5 order by subscriberid desc");
while($r=mysql_fetch_assoc($result))
{
$joomlaid = $r["subscriberid"];
}
the above sql statement dosen't pull the latest data but the last record data. How do I move the pointer to the first record?
$result = mysql_query("Select subscriberid from SendStudio_list_subscribers where formid=5 order by subscriberid desc");
while($r=mysql_fetch_assoc($result))
{
$joomlaid = $r["subscriberid"];
}
From the above $joomlaid stores the value from the database. this is how I display the value:
you have to echo it within the loop, otherwise it just outputs the last value the variable was set to.
but what you want to do is only echo one i see,
So do what you just did, except use mysql_query("SELECT field FROM table ORDER BY value DESC LIMIT 1"); change value to that value you are talking about, and it will get you the latest one only. Since you arent limiting it to one, it is going through all the results and only echoing after it has finished looping. by the time it finishes the loop, it has set the variable to your desired value, but it has also proceeded to set it to the one less, one less, one less, etc.