Hi, I have a simple problem, I'll try to explain it as best I can:
News entries in my database are ordered from oldest to newest. In order to pull out the last 10 lines I do this:
$newsquery=mysql_query("SELECT * FROM news ORDER BY timestamp DESC LIMIT 10");
while($row = mysql_fetch_array($newsquery)){
echo '<b>' .$row['line']. '</b>
';
}
It spits out something like this:
most recent news in db
second most recent news in db
third most recent news in db
etc...
The problem is I need to flip that list so the oldest of the 10 is on top and the newest is on bottom.
What I've tried:
$row = array_reverse(mysql_fetch_array($newsquery)))
array_reverse didn't seem to do anything.
I've also read that it can be done with a subquery, but the explanation wasn't that great.
Any help would be much appreciated!
Comma seperated implode & modifying returned string.
I have a PHP post form that posts up to 4 variables. I need whatever variables are passed to be combined into one comma seperated string (eg variable1,variable2,variable3,variable4). This i can do
Estimations and Effort
HI Gurus,
search function
HI guys,if anyone could point us in the right direction of how to do this, or provide some test code for a similar problem would be great!Basically, I have user profiles on my site, and I have a
Which PHP-Editor do you think is the best?
Hi everyone, Myself Brian Anderson. For the last 2 years i have been working as a php-professional. I would like to conduct a poll for knowing which PHP-Editor you guys think is the
Problem with PHP code- simple contact form
Hi Folks, I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form with PHP code in it- grabbed it from the sitemaster website. Unfortunately my form isn't
Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to put the CRON code do I put it in the header between the head tags? do I put it before any html code?
difference between datetimes
($row['totime']-$row['fromtime'])/60this is giving me 0example of totime and fromtime are:2009-12-26 01:10:05 and 2009-12-26 1:03:01i was thinking that with those values i would end up with something
isset undefined variable
Hi all,Hope someone can point out the obvious. I've a log in script, if you dont enter a username or pw, you get a red asterix show by the field and a pop up.If you enter an email but not the pw, it
listcube issue
Hi
session_destroy();
new to phpI have a simple login and am trying to write a logout.I set a $_SESSION var to 1 if they are logged in:if(isset($_POST['logname'])){ $UserArr = chk_lgn($_POST['logname'],$_POST['passwd']);