Question: I'm trying to install yourls.org url shortener software on my server in a subdirectory: http://[mydomain.tld]/y/admin/install.php. Numerous install attempts result in the following errors:

```
Error creating table 'y20130519_url'.
Error creating table 'y20130519_options'.
Error creating table 'y20130519_log'.
Error creating YOURLS tables.

File .htaccess successfully created/updated.

```

I've double-checked the db user and password. I even tried creating new ones. I've reinstalled a few times. 

In phpMyAdmin, I verify that no tables have been added to the database, as suggested by the errors.

In the config file, I modified the following [sensitive info replaced generically here]:

```
define( 'YOURLS_DB_USER', '[my new db user name is here]' );

define( 'YOURLS_DB_PASS', '[my new db password is here]' );

define( 'YOURLS_DB_NAME', '[my new db name is here]' );

define( 'YOURLS_DB_PREFIX', 'y20130519_' );

define( 'YOURLS_SITE', 'http://[mydomain.tld]/y' );

define( 'YOURLS_HOURS_OFFSET', -5 ); 

define( 'YOURLS_COOKIEKEY', '[I typed random characters here]' );

$yourls_user_passwords = array(
'[I created new user]' => '[I created new password]',
'[I created another new user]' => '[I created another new password]'    // You can have one or more 'login'=>'password' lines
);

```

Any ideas?

Answer: 
The field you wish to sort on, `comments.timecomment`, does not seem to be selected in the inner SELECT query ... Also, explicit reference to the table name may not be necessary in the outer query if the field name is unique.

How about:

```
SELECT * 
FROM( 
    SELECT users.id, users.nome, users.email,users.foto, comments.content,
    comments.timecomment
    FROM users, comments 
    WHERE comments.posts_id=? AND comments.users_id=users.id
    ORDER BY comments.id DESC LIMIT 5) 
AS dummy 
ORDER BY timecomment ASC

```
If your goal just to output found comments reverse it in php:

```
SELECT users.id, users.nome, users.email,users.foto, comments.content
  FROM users, comments 
  WHERE comments.posts_id=? AND comments.users_id=users.id
  ORDER BY comments.id DESC LIMIT 5

```

$comments = array\_reverse($comments);