gpt4 book ai didi

php - mysql_query 返回 value 和 null 但应该只有 value

转载 作者:行者123 更新时间:2023-11-30 00:14:06 25 4
gpt4 key购买 nike

我通过从 php 以 json 表示法返回我的 mysql_query 得到了一些空值。某些字段(例如 bookid、名称、作者、持续时间)会返回值,而其他字段则不会!但我在 DBVisualizer 中输入相同的查询,但只得到了值...这里有什么问题?

    echo $myuserid . "idcheck";
$q1 = "select u.address as address, u.postcode as postcode, u.town as town, u.telnumber, u.mail, b.bookid as bookid, b.name as name, b.author as author, s.duration as duration from status s, book b, user u where s.bookid = b.bookid and s.borroweruserid = u.userid and s.borroweruserid = $myuserid";
echo $q1;
$sth = mysql_query($q1) or die(mysql_error());

while($rowla = mysql_fetch_assoc($sth)) {

$rows[] = array(
'address' => $rowla['address'],
'postcode' => $rowla['postcode'],
'town' => $rowla['town'],
'telnumber' => $rowla['telnumber'],
'mail' => $rowla['mail'],
'bookid' => $rowla['bookid'],
'name' => $rowla['name'],
'author' => $rowla['author'],
'duration' => $rowla['duration']);
// 'pic' => base64_encode($row['pic']
//$rows[] = $r;
}
$j1 = json_encode($rows);

更新:将 error_reporing 放入 php 脚本时没有任何效果(不执行任何查询)并且在 while 之后添加 print_r($rowla)仍然得到这个反馈(第二个查询正在做同样的事情 - 只是有点不同): http://s24.postimg.org/4wpu29zwl/Screen_Shot_2014_05_22_at_08_45_02.png

最佳答案

你想念你的sql。我想。

$q1 = "SELECT u.address AS address, u.postcode AS postcode, u.town AS town, u.telnumber, u.mail, b.bookid AS bookid, b.name AS name, b.author AS author, s.duration AS duration from status s, book b, user u WHERE s.bookid = b.bookid AND s.borroweruserid = u.userid AND s.borroweruserid = '".$myuserid."'";

关于php - mysql_query 返回 value 和 null 但应该只有 value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23799054/

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