php - Wordpress custom leftjoin on two tables -


i'm new idea of left-joining.

i have created 2 custom tables within wordpress database. 1 detail (containing leads) , 1 storing car dealers.

when send lead cardealer, store id of cardealer column "sent_to" in detail table. want show car dealers have received each lead.

and here comes leftjoin:

global $wpdb;  $cardealers = $wpdb->get_results(      "select detail.name, cardealers.user_id     detail     left join cardealers on  cardealers.user_id = detail.sent_to" ); 

and how try input results:

foreach($cardealers $cardealer) {     $name = $row->name;     echo $name; } 

but can guess, nothing happens.

hope can help.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -