Search found 10 matches

by JBrown1045
Mon Jun 20, 2005 12:24 pm
Forum: PHP - Code
Topic: [SOLVED]PHp/MySQL Question
Replies: 6
Views: 367

col_name has to be the name of a column in your db-table, e.g. $query = mysql_query("SELECT name,title,story,time FROM tblstory ORDER BY time DESC",$link); The value of "time" determines the order in which the rows are fetched from the db-table. Worthwhile reading up on time &am...
by JBrown1045
Mon Jun 20, 2005 11:59 am
Forum: PHP - Code
Topic: [SOLVED]PHp/MySQL Question
Replies: 6
Views: 367

patrikG wrote:

Code: Select all

$query = mysql_query("SELECT name,title,story,time FROM tblstory ORDER BY col_name DESC",$link);
I did that, but its giving me this erro:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/rlzcjewc/public_html/stories.php on line 80
by JBrown1045
Mon Jun 20, 2005 9:53 am
Forum: PHP - Code
Topic: [SOLVED]PHp/MySQL Question
Replies: 6
Views: 367

phpScott wrote:

Code: Select all

blah ORDER BY col_name DESC
should do the trick

use ASC for ascending and DESC for descending.
so the line should look like this?

Code: Select all

$query = mysql_query("SELECT name,title,story,time FROM tblstory WHERE ORDER BY col_name DESC>0",$link);
by JBrown1045
Mon Jun 20, 2005 9:18 am
Forum: PHP - Code
Topic: [SOLVED]PHp/MySQL Question
Replies: 6
Views: 367

[SOLVED]PHp/MySQL Question

On a form, how can I get the results to be echoed out with the newest being first instead of the oldest first? I went to MySQL.org to see if I could figure out Order By function, but I couldn't get it to work. Here is what I have: CREATE TABLE `tblstory` ( `id` int(11) NOT NULL auto_increment, `name...
by JBrown1045
Sun Jun 19, 2005 11:09 pm
Forum: PHP - Code
Topic: A Few Quick Questions
Replies: 14
Views: 958

on mmessage.php change $query = mysql_query(&quote;SELECT name,message,time FROM tblmessages WHERE id>0&quote;,$link); while($row = mysql_fetch_row($query)) { $dateis = date(&quote;m/d/Y&quote;, $rowї3]); } to $query = mysql_query("SELECT name,message,time FROM...
by JBrown1045
Sun Jun 19, 2005 6:42 pm
Forum: PHP - Code
Topic: A Few Quick Questions
Replies: 14
Views: 958

What do your time fields look like? Are they being inputted correctly? my time fields? I only have one. It just is suppose to show Month/Day/Year The form works it just keeps echoing wrong. This may help you out: My table: CREATE TABLE `tblstory` ( `id` int(11) NOT NULL auto_increment, `name` text ...
by JBrown1045
Sun Jun 19, 2005 5:21 pm
Forum: PHP - Code
Topic: A Few Quick Questions
Replies: 14
Views: 958

does table have timestamp column (datetime)? If not, it won't work. See my first post. Table is set up like this: CREATE TABLE `tblstory` ( `id` int(11) NOT NULL auto_increment, `name` text NOT NULL, `title` text NOT NULL, `story` text NOT NULL, `time` int(11) NOT NULL default '0', PRIMARY KEY (`id...
by JBrown1045
Sun Jun 19, 2005 4:58 pm
Forum: PHP - Code
Topic: A Few Quick Questions
Replies: 14
Views: 958

probably want to have a look at functions like DATE_FORMAT for MySQL... Instead of performing a php call to date for every row... Probably. Let's see :) $query = mysql_query(&quote;SELECT name,message,time FROM tblmessages WHERE id>0 ORDER BY time ASC LIMIT 0,10&quote;,$link); You most prob...
by JBrown1045
Sun Jun 19, 2005 2:08 pm
Forum: PHP - Code
Topic: A Few Quick Questions
Replies: 14
Views: 958

the message being newest first: you need a larger description on how the thing runs at the moment, are each of the stories in individual txt files or are they in the same txt file. If they are in the same file you can explode() the file after reverse_array() the order. If that is no help you may ne...
by JBrown1045
Sun Jun 19, 2005 1:22 pm
Forum: PHP - Code
Topic: A Few Quick Questions
Replies: 14
Views: 958

A Few Quick Questions

hello: I am very new to PHP. I know some coding, but a few I am not aware of. On the page danaplatoforever.com/stories.php what code can I use to get the stories to be posted with the newest coming up first? Secondly on danaplatoforever.com/mmesages.php it keeps showing the date 12/31/1969. WHat am ...