gpt4 book ai didi

php - 内连接 : Notice: showing Undefined Index

转载 作者:行者123 更新时间:2023-11-29 05:07:46 25 4
gpt4 key购买 nike

我有两个表 temp_bidpost_project。我想要投标项目的记录。为此,我使用 INNER JOIN 进行了查询,但出现未定义索引错误。它适用于 MySQL 编辑器。

这是我的代码。

<?php
include 'conn.php';
session_start();
if ($_SESSION['EmailID'] == "") {
header("location:index.html");
}

$getTempBid = "SELECT * from temp_bid TB INNER JOIN post_project P ON P._id = TB.prj_id " +
" WHERE TB.bidBy = '" .$_SESSION['EmailID']."'";

$tempBidResult = mysqli_query($conn,$getTempBid);

while($fetchTempBid = mysqli_fetch_row($tempBidResult)) {
$tempBidId = $fetchTempBid['tempBidId'];
$tempBidPrjId = $fetchTempBid['prj_id'];
$tempBidPostBy = $fetchTempBid['postBy'];
$tempBidBy = $fetchTempBid['bidBy'];
$tempBidOn = new DateTime($fetchTempBid['bidOn']);
$tempBidAmount = $fetchTempBid['amount'];
$tempBidDays = $fetchTempBid['days'];
$tempBidProposalDetails = $fetchTempBid['proposalDetails'];
$tempBidStatus = $fetchTempBid['bidStatus'];
$prjId = $fetchTempBid['_id'];
$prjTitle = $fetchTempBid['projectTitle'];
$prjDescriptions = $fetchTempBid['projectDescriptions'];
$prjSkills = $fetchTempBid['projectRequiredSkill'];
$prjSkills1 = explode(",", $prjSkills);
$prjBudget = $fetchTempBid['projectBudget'];
$prjPostDate = new DateTime($fetchTempBid['projectCreatedOn']);
$prjStatus = $fetchTempBid['projectStatus'];
}
$records = mysqli_num_rows($tempBidResult);
?>

输出:

Notice: Undefined index: tempBidId in C:\wamp\www\Gopinath Infosystem\testpage.php on line 23
Notice: Undefined index: prj_id in C:\wamp\www\xxx\testpage.php on line 24
Notice: Undefined index: postBy in C:\wamp\www\xxx\testpage.php on line 25
Notice: Undefined index: bidBy in C:\wamp\www\xxx\testpage.php on line 26
Notice: Undefined index: bidOn in C:\wamp\www\xxx\testpage.php on line 27
Notice: Undefined index: amount in C:\wamp\www\xxx\testpage.php on line 28
Notice: Undefined index: days in C:\wamp\www\xxx\testpage.php on line 29

最佳答案

mysqli_fetch_row 返回一个带有数字键的数组。来自documentation :

Fetches one row of data from the result set and returns it as an enumerated array, where each column is stored in an array offset starting from 0 (zero). Each subsequent call to this function will return the next row within the result set, or NULL if there are no more rows.

使用mysqli_fetch_assoc而不是返回一个数组,其中的键是列名。

关于php - 内连接 : Notice: showing Undefined Index,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45017687/

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