简体   繁体   中英

inner join query don't return any things

I have a php code that use a mySQL query in it. tables users and conversation and main_profile have true values to select after this query but query return nothing.

$sqlQuer = 
"SELECT `conversation`.from,`conversation`.text, `main_profile`.nik_name, `users`.id  
FROM `conversation` 
INNER JOIN `users` ON(`users`.username = `conversation`.to ) 
INNER JOIN `main_profile` ON(`users`.id = `main_profile`.user_id) 
WHERE `conversation`.to = '".$to."' 
AND `conversation`.read = '0'";

$result = mysql_query( $sqlQuer) or die (mysql_error());
while($row = mysql_fetch_array($result))
{
    echo $row[0] . "#TEXT#" . $row[1]. "#TEXT#" . $row[2] . "#CON#";
    $ids[] = $row['id'];
}

any Idea ?

通过此更改解决了查询,第一个INNER JOIN更改为LEFT JOIN,第二个更改为RIGHT JOIN。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM