0

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

$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);
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by almostbob
0
$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);

tags, syntax highlighting

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[code=php] tags, syntax highlighting

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; // looks more usual to me
what is the exact error message
and where did you put the order by clause in this code

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.