| | |
Order by name
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
hi,
i have this script, which i want to order by name. but when i say order by name asc at the end i get error:
here is the bit i am changing
i have this script, which i want to order by name. but when i say order by name asc at the end i get error:
here is the bit i am changing
PHP Syntax (Toggle Plain Text)
$genre_id = $_GET['id']; $items = ITEMS_PER_PAGE; if(isset($_GET['page'])) { $offset = $_GET['page']; $offset *= $items; $query = 'select * from artist where genre_id = '.mysql_real_escape_string($genre_id)." limit $offset,$items"; } else { $query = 'select * from artist where genre_id = '.mysql_real_escape_string($genre_id); } $allArtists = mysql_query($query);
php Syntax (Toggle Plain Text)
$genre_id = $_GET['id']; $items = ITEMS_PER_PAGE; if(isset($_GET['page'])) { $offset = $_GET['page']; $offset *= $items; $query = 'select * from artist where genre_id = '.mysql_real_escape_string($genre_id)." limit $offset,$items"; } else { $query = 'select * from artist where genre_id = '.mysql_real_escape_string($genre_id); } $allArtists = mysql_query($query);
select * doesnt allow "us" to see the column names, Is there a column "name"
$items = // are you sure about this definition it doesnt look right
$items = $_GET['ITEMS_PER_PAGE']; // looks more usual to me
what is the exact error message
and where did you put the order by clause in this code
Last edited by almostbob; Mar 17th, 2009 at 11:08 am.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Other Threads in the PHP Forum
- Previous Thread: phpMailer mail goes into junk folder
- Next Thread: If Statement Error
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web websphere white xml youtube






