Topic awaiting preservation: Database fun (The second PHP thread in the hateful answers series) (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Juneau, Alaska |
posted 07-14-2004 02:10
Once again, I was hesitant to ask this, but every tutorial I find falls just short of providing the information I need. |
Paranoid (IV) Inmate From: France |
posted 07-14-2004 03:07 |
Nervous Wreck (II) Inmate From: Sydney, Australia |
posted 07-14-2004 15:16
you could try the following: |
Nervous Wreck (II) Inmate From: Juneau, Alaska |
posted 07-14-2004 19:10
Is there a php equivalent to orderby? Say I query like so: code: $Query = "Select * from $tablename";
|
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 07-14-2004 19:22
php->sort(), php->usort(), php->ksort() all could be used after you read your data into an array - but why can't you use order by?? |
Nervous Wreck (II) Inmate From: Sydney, Australia |
posted 07-15-2004 11:33
to get the result of the query in the correct order, i think you just add the 'order by ???' to the end of your quewry like this: |
Nervous Wreck (II) Inmate From: Sydney, Australia |
posted 07-15-2004 11:45
i think you can just add the 'order by ???' to the end of your query like this: |
Nervous Wreck (II) Inmate From: Sydney, Australia |
posted 07-15-2004 13:03
sorry about the double entry i am having trouble with my isp dropping out tonight |
Nervous Wreck (II) Inmate From: Juneau, Alaska |
posted 07-16-2004 00:32
code: $query = "select * from $tablename order by id desc";
code: while (($row = mysql_fetch_array($result))&&($facecount < 5)) {
|
Paranoid (IV) Inmate From: France |
posted 07-16-2004 00:40
you know you can use an order by clause AND a limit clause in the same query. |
Bipolar (III) Inmate From: Australia |
posted 07-16-2004 01:47
yeh i have to do what youve done above for an access database, but sql has a limit clause you can use. Would be handy too |
Nervous Wreck (II) Inmate From: Juneau, Alaska |
posted 07-16-2004 17:46
I wasn't aware of the limit clause. I'm new to programming altogether, and I've never used MySQL except for that orderby statement. Anyway, thanks for pointing that out |