Preserved Topic: PHP News script help |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: Drexel Hill, Pennsylvania |
posted 04-11-2001 17:41
I recently finished reading PHP 4 Bible. Now I am trying to make my first script in PHP. I am running into trouble with the script that displays the news form my MySQL database. I want the script to display the news posting from the database by ID, form the greatest ID(The newst post), to the least ID(The oldest post). I am not shure how to order the results from the query. Any help is appreciated. I will enclose the display code below. |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 04-11-2001 18:16
Well your code is a bit sloppy, but that is OK, remember PHP is an embedded language, so you can put the HTML tags anywhere in the doc, which may make things easier to keep a handle on. Your problem there would be with SQL and not PHP. code: //Get info from the database
|
Bipolar (III) Inmate From: Drexel Hill, Pennsylvania |
posted 04-11-2001 19:28
thanks for the help. I have been working on this for a few days now, and the answer seems so simple. I appreciate it. If you are referring to the ord() function, if i am not mistaken i tryed it and it did not work. Then again I am new to this, so i could have been doing something wrong. Thanks again. |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 04-11-2001 19:42
You are correct it did not work. |
Bipolar (III) Inmate From: Drexel Hill, Pennsylvania |
posted 04-11-2001 20:00
Ahh I see. Good debugging on your part, I never would have caught that. Thanks again! |
Paranoid (IV) Inmate From: other places |
posted 04-11-2001 20:53
Also, on the MySQL side, make sure your ID field is an index if you plan on having lots of rows. Makes that ORDER BY clause dramatically faster. |