CodeIgniter Forums

Full Version: my query donsn't return any record
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Who knows what the problem is? 

PHP Code:
SELECT `track`.`id`, `track`.`artist_id`, `track`.`genre_id`, `track`.`title`, `track`.`cover`, `track`.`exclusive`, `track`.`count_download`, `track`.`url`, `artists`.`id` `artid`, `artists`.`artist_name`, `g`.`id` `gid`, `g`.`name`
FROM `track`
JOIN `artistsON `artists`.`id` = `artist_id`
JOIN `genres` AS `gON `g`.`id` = `genre_id`
WHERE LOWER(track.titleLIKE 'Bass%' 
How can a LOWER()ed value start with a capital letter?
(08-31-2017, 05:43 AM)Narf Wrote: [ -> ]How can a LOWER()ed value start with a capital letter?

mysql does not care. abcd is the same as AbCd (depend on the character collation). Does postgresql the same?

I believe programmer use mysql and is a beginner. programmer delete an artists or genres and forgot to check if the value is needed.

@programmer,
A join is in mysql a inner join. If the artist_id or genre_id is null or the id value does not exist in artists/genres you get no records.
@programmer,

More information please...
What database are you using? Version?
Based on your joins what are you expecting to see?
Are you sure that you are using the correct join?
Run the query in PhpMyAdmin. Is it giving any results?
Looks like you got syntax error in join such as
JOIN `artists` ON `artists`.`id` = `artist_id`
JOIN `genres` AS `g` ON `g`.`id` = `genre_id`

I think it should have been
JOIN `artists` ON `artists`.`id` = `track`.`artist_id`
JOIN `genres` AS `g` ON `g`.`id` = `track`.`genre_id`

such as missing track

Regards