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);
$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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.