mysql - INNER JOIN custom tables - SQL Query

admin2025-04-19  0

H, I am trying to get results from two tables with INNER JOIN in WordPress theme template file, but I don't know what's I am doing wrong. Please help me, here is the code below

global $wpdb;
$user_id = get_current_user_id();
$sql= "SELECT client_id FROM quotes INNER JOIN client_info ON quotes.client_id = client_info.id WHERE user_id =".$user_id;
// user_id column has the data current user_id in it
 $results = $wpdb->get_results($sql);
  print_r($results); // results displays an empty array but both tables have data
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745013922a279972.html

最新回复(0)