我有一个严重的问题!
我想在数据库中使用不同表中的不同值。我的桌子:
用户
user_id |名字|电子邮件|密码|颜色|创建
父母
parent_id |电子邮件|密码
所以,我想用电子邮件col连接这些表。但密码cols是不同的。
这是我的代码:
3 -> 3
0.0000000000000001 -> 1e-16
1234567891011121314 -> 1.234568e18
3.1415926535897932384626433832 -> 3.141592654
0.00010001000100010001 -> 0.00010001
我如何在一个代码中使用这些表?请帮忙!顺便说一下,错误是这样的:
mysqli_fetch_assoc()期望参数1为mysqli_result,给出布尔值 mysqli_num_rows()期望参数1为mysqli_result,布尔值为
答案 0 :(得分:0)
也许使用这样的组合查询(join):
select a.*, b.* from table users as a join parents as b on a.email = b.email where a.email = "$email" and a.password = "$password"
更新:
SELECT b.user_id, a.email, b.email as parent_email, a.name, a.color, b.password as parent_password FROM users AS a INNER JOIN parents AS b ON a.email = b.email WHERE b.email = '$email' AND b.password = '$password' ;
$email = mysqli_real_escape_string( $this->_con, $trimmed_data['parent_email'] );
$password = mysqli_real_escape_string( $this->_con, $trimmed_data['parent_password'] );