Closed Thread Icon

Topic awaiting preservation: Stupid PHP tutorial books (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=24364" title="Pages that link to Topic awaiting preservation: Stupid PHP tutorial books (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Stupid PHP tutorial books <span class="small">(Page 1 of 1)</span>\

 
ddade13x
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Aug 2004

posted posted 12-12-2004 06:37

Hey guys,

I'm currently attempting to teach myself a little about PHP and mySQL. The problem I'm having is that the book I'm reading seems to only give me half the answers. The book I'm referring to is Sam's PHP mySQL, Apache teach yourself in 24 hours book. In it, there is code for displaying topic lists from a forum in reverse date order.
The problem lies in the fact that it just assumes that reading the code tells you that it is reversing the order, without ever saying HOW it does it. The offending code is as follows:

code:
...
$get_topics = "select topic_id, topic_title, date_format(topic_create_time, '%b %e %Y at %r')
as fmt_topic_create_time, topic_owner from foru _topics order by topic_create_time desc";
$get_topics_res = mysql_query($get_topics,$conn) or die(mysql_error());
...



I guess my question is - What about this code makes it list the topics in order from most recent to oldest date? Is this just how mySQL does it or is it something about the PHP? The strange thing is, I've tried this and without this(these) line(s) of code, it appears to list from oldes to newest dates, I just can't figure it out.

Help is much appreciated, also, if you have a better book suggestion, I will take those as well.

Dustin

(Edited by DocOzone on 12-13-2004 08:25)

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: San Diego, California
Insane since: Mar 1994

posted posted 12-12-2004 08:24
quote:
order by topic_create_time desc


I kind of like how www.mysql.com writes out their code, with the actual SQL bits in CAPITALS, and all the other stuff in mixed case. By that standard, the above quoted segment would read like...

quote:
ORDER BY topic_create_time DESC


So, the bit that's important is the ORDER BY part. What is it ordering the results by? The field "topic_create_time" from the table "foru_topics". You can order this one of two ways, either DESCending (from big to small), or ASCending (small to big). More on this can be found here.

Personally, I learned all of my PHP and MySQL from the help document at http://www.php.net/, the official PHP site. Track down the windows help file version, it's pretty frikking useful. =) You'll notice when it talks about MySQL stuff, it offers some simple examples that you can then poke around with and see what they do for yourself.

Again, those two resources that will make your day are...
http://www.php.net/
http://www.mysql.com/

All the others are mainly selling books, not really teaching you at all, IMHO.
YMMV.

Your pal, -doc-

(Edited by DocOzone on 12-12-2004 08:24)

ddade13x
Obsessive-Compulsive (I) Inmate

From:
Insane since: Aug 2004

posted posted 12-12-2004 17:17

THANK YOU!!!!

Ahh, DocOzone, you are the best. I wrote you a few years ago personally and you were very helpful then as well. For the life of me I didn't even think that "DESC" meant DESCending. I thought it just meant order by that DESCription, in other words, order by that field in the table. I just took another look through the book again and I cannot find where it explains that specific function. It isn't even listed in the index of the book where all the other functions I've looked for are listed.

Again, thank you...and thank you for this forum, although I don't write much it is a priceless wealth of knowledge.

Dustin

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: San Diego, California
Insane since: Mar 1994

posted posted 12-13-2004 08:24

=) I never much liked any of the books published, unfortunately. Some of the coding books make nifty footrests, keep those feet elevated and take care of your back! Really though, dig into the PHP help file, the windows .CHM file is on my desktop and I refer to it nearly every day.

Your pal, -doc-

I X I
Paranoid (IV) Inmate

From: beyond the gray sky
Insane since: Apr 2004

posted posted 12-13-2004 09:00

another really good site that I've been going to is www.w3schools.com . it's pretty well organized and has answered many of my questions about php, css and html (and more, if only I knew how to use them lol)



Do you serve a purpose or purposely serve (Corey Taylor)

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 12-13-2004 22:35

I have no information to offer here.....I just wanted to say..........IS THAT DOC OZONE!!!!????

Hope all is well Doc and glad to see you wondering the halls.

Later,

C:\

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 12-16-2004 18:58

Huh? Hey? What?

Here I go looking for some info on maybe starting to learn a new skill and I come across a Doc sighting!

Almost made me put down my coffee! Hey, Doc! >waves<

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: San Diego, California
Insane since: Mar 1994

posted posted 12-17-2004 06:52

<waves back at Wes> =)

Your pal, -doc-

I X I
Paranoid (IV) Inmate

From: beyond the gray sky
Insane since: Apr 2004

posted posted 12-17-2004 11:39

hey doc, took your advice (although not directed at me) and got the PHP .chm for windows. already saved me from asking a silly question here thanks a bunch

LINKS:
PHP Manual - ~4.5MB
Extended PHP Manual - ~7.5MB
All versions of the above files - includes single HTML, multiple HTML (.gz format download) and around 20 languages

just thought I'd take this time to personally thank the good doctor for giving web-heads like us a common meeting ground. so, thanks



You could stand me up at the gates of hell, but I won't back down (Tom Petty)

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 12-17-2004 15:15

oh my! Doc! Old friend! So good to see you again!

*runs up and shakes Doc soundly by the hand*


Justice 4 Pat Richard

« BackwardsOnwards »

Show Forum Drop Down Menu