| | |
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: unable to connect to MYSQL via PHP
- Next Thread: If Statement Error
Views: 244 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cookies 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 jquery limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube






