CodeIgniter Forums
my query donsn't return any record - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: my query donsn't return any record (/showthread.php?tid=68826)



my query donsn't return any record - programmer - 08-31-2017

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%' 



RE: my query donsn't return any record - Narf - 08-31-2017

How can a LOWER()ed value start with a capital letter?


RE: my query donsn't return any record - Paradinight - 08-31-2017

(08-31-2017, 04: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.


RE: my query donsn't return any record - php_rocs - 09-01-2017

@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?


RE: my query donsn't return any record - Wouter60 - 09-02-2017

Run the query in PhpMyAdmin. Is it giving any results?


RE: my query donsn't return any record - ciadvantage - 09-08-2017

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