6
我想選擇其他POST值是一個數組的值,我不知道我的查詢給我這個錯誤是什麼問題。我想知道什麼課程只是添加到表中。我有五個輸入的形式。如何選擇其他值是數組的值?
Notice: Trying to get property of non-object in C:\Apache\htdocs\xxx\addcourse.php on line 262
這裏是我的代碼
<?php
if(isset($_POST['Submit'])) {
$code= isset($_POST['code']) ? $_POST['code'] : '';
$coursecode = isset($_POST['coursecode']) ? $_POST['coursecode'] : '';
$both=$code[$x] .' '. $coursecode[$x];
$sqlcourses = "SELECT * FROM courses where course_code='$both' ORDER BY course_id DESC LIMIT 5 ";
$resultcourses = $mysqli->query($sqlcourses);
if ($resultcourses->num_rows > 0) {
while($row = $resultcourses->fetch_assoc()) {
?>
</p>
<p> </p>
<p> </p>
<table width="415" border="0">
<tr>
<?php
$courses=$row["course_code"];
echo $courses;
?>
</div>
</tr>
</table>
<?php
}
}
}
?>
和線的代碼是262? – Misunderstood
我剛剛注意到我需要在查詢中將$ $同時編輯爲'$ both'。不知道錯誤,但不給我任何結果? –
您的查詢失敗。乍一看,'$ both'包含一個空格 - $ $ both = $ code [$ x]。' 」。 $ coursecode [$ x];',所以它需要用引號包裹 - '... where course_code ='$ both'...'。 – Sean