You are here: Re: Any ideas why a mysql 'order by' does not work any more ?? « PHP Language « IT news, forums, messages
Re: Any ideas why a mysql 'order by' does not work any more ??

Posted by Hilarion on 10/07/35 11:24

shorty wrote:
> > > The following piece of code has worked in the past but any ideas why
> > > it does not work now ???
> > >
> > > $sql = mysql_query("ALTER TABLE `words` ORDER BY `counter` DESC");

> > So what are you trying to do? Maybe you meant
> > SELECT * FROM `words` ORDER BY `counter` DESC?

> > > The code that is above it, also uses the same database, username,
> > > password etc and works fine.
> > >
> > > The mysql scheme privilges are set to 'select' and 'update'

> > See you used ALTER not SELECT or UPDATE.


> After a customer enters data into a table, and then leaves the
> website.
>
> All I want to do is sort (numerically) a particular column in the
> table, and then resave the table, ready for its next use.


Tables in SQL databases are not sorted in any way and you can't
make them be sorted.
What you can do is to sort the data you get from table when
you select the data as Stefan described.

Only statement with which "ORDER BY" can be used is "SELECT"
(not CREATE, ALTER, DROP, INSERT, UPDATE or DELETE).


Hilarion

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация