PHP/MySQL에서하고있는 프로젝트에 대한 질문이 있습니다. 나는 사용자가 자신의 금융 계좌 (은행 계좌/신용 카드 등)를 기록 할 수있는 사이트를 설계하고 있으며, 각 사이트에서 월 단위로 수행하는 트랜잭션과 유형을 설계하고 있습니다. 내가 원하는 것은 사용자가 특정 계정을 선택하고 GET을 사용하여 계정 ID를 가져 와서 해당 계정 이름과 관련된 모든 트랜잭션을 가져올 수 있다는 것입니다. 여기에 내 코드가 있습니다. 사과하지 못하면 정말 이걸 배워서 다양한 온라인 자습서의 작은 조각들을 꿰뚫어 볼 수 있습니다. 나는 사람이 볼 수 온라인 2 에 기호 "그러나 나는이없는, 라인 2에"나는 근처에 구문 오류가 오류를 받기를 실행하려고에Prepared Statement issue
//connect to database
include ('connect-To-db.php');
//Ensure the id is appropriate
if (is_numeric($_GET['id']) && $_GET['id'] > 0)
{
// get 'id' using GET superglobal variable
$id = $_GET['id'];
// get the credits, debits & catagory from the transactions table for that account
if ($stmt = $mysqli->prepare("SELECT `Credit`,`Debit`,`Catagory` FROM `transactions` WHERE `Accname` IN
(SELECT `Accname` FROM `Accounts` WHERE `accID`=?")) {
$stmt->bind_param("i", $id);
$stmt->execute();
$stmt->bind_result($id,$Credit, $Debit, $Cat);
//Loop through the results and display in a table format
echo"<table>";
echo "<th>Credits></th><th>Debits</th><th>Catagory</th>";
while($row = $stmt->fetch()){
echo "<tr>";
echo "<td>.$Credit.</td>";
echo "<td>.$Debit.</td>";
echo "<td>.$Cat.</td>";
echo "</tr>";
}
echo "</table>";
$stmt->close();
}
// show an error if their is a problem connecting to the table
else {
echo "Error: could not prepare SQL statement".$mysqli->error;
}
}
내가 무엇을 잘못하고 있는가?
"도움을 요청하는 중입니다"는 알려드립니다. 이 사이트는 도움이 아닌 질문에 관한 것입니다. –
그걸 축하해. – Steve73NI
어리석은 편집이 도움이됩니다. 말씨에 관한 것이 아니라 * 문제에 관한 것입니다. 귀하의 "질문"은 귀하가 어떻게 말씀 하시든 "도움"에 관한 것입니다. –