gpt4 book ai didi

php - 从查询中提取 MySQL 数据

转载 作者:行者123 更新时间:2023-11-28 23:56:50 25 4
gpt4 key购买 nike

<分区>

$sql = 'SELECT users.NAME, company.name
FROM users
LEFT JOIN (user_company_access, company) ON (users.USER_ID=user_company_access.company_id AND user_company_access.company_id=company.company_id)
WHERE users.USER_ID="1" AND company.company_id=users.USER_ID';
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo "USER ID :"+$row[0]+" <br> ";
}

我得到:

Notice: Undefined offset: 0 in C:\xampp\htdocs\index.php on line 23
0
Notice: Undefined offset: 0 in C:\xampp\htdocs\index.php on line 23
0Fetched data successfully

有没有办法直接拉取数据?我也尝试过 $row['users.NAME'] 之类的操作,但仍然失败。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com