意外的文件结尾-php 询问任何与烹饪相关的疑问或从已回答的问题中学习。 问一问你的疑问 把你的问题写在这里 现在问我 发送。。。 成功!当Kavita回答问题时,您将收到一封电子邮件:D 出现未知错误:(请重试或刷新页面。 最近回答的问题
这是我php代码的一个片段。我不知怎的发现这里发生了错误意外的文件结尾-php 询问任何与烹饪相关的疑问或从已回答的问题中学习。 问一问你的疑问 把你的问题写在这里 现在问我 发送。。。 成功!当Kavita回答问题时,您将收到一封电子邮件:D 出现未知错误:(请重试或刷新页面。 最近回答的问题,php,Php,这是我php代码的一个片段。我不知怎的发现这里发生了错误意外的文件结尾。但我不明白为什么。 更新 当我注释掉echo$rowCount时,它没有显示任何错误。错误没有发生在那里。它发生在括号({)或括号(()未闭合的地方。您需要为我们发布更多代码以确定确切的问题。可能您发布的块位于if或else块或循环中,没有结束}?添加了代码供您查看。我甚至尝试在验证php代码。它说没有问题。请也发布footer.inc。 <?php session_start(); if(isset($_SESSI
意外的文件结尾。但我不明白为什么。
更新
当我注释掉echo$rowCount时,它没有显示任何错误。错误没有发生在那里。它发生在括号({
)或括号((
)未闭合的地方。您需要为我们发布更多代码以确定确切的问题。可能您发布的块位于if
或else
块或循环中,没有结束}
?添加了代码供您查看。我甚至尝试在验证php代码。它说没有问题。请也发布footer.inc。
<?php session_start();
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in'])
{
header('Location: /admin');
}
include 'includes/header.inc'; ?>
<div class="main_content_wrapper">
<div class="main_content limit_main_content_width margin_center p20">
<div class="question_wrapper main_content_content homepage_section" style='margin-top: 20px'>
<div>Ask any cooking related doubts or learn from already answered quesetions.</div>
</div>
<div class="question_wrapper main_content_content homepage_section">
<div class='big_heading'>Ask your doubt</div>
<div class="question_wrapper_content question_div_wrapper mb10">
<div class="question_wrapper_content question_div_wrapper placeholder_text js_main_question_placeholder">Write your question here</div>
<div class='question_wrapper_content question_div_wrapper ask_question_box p20 subtle_border radius3 mb10 js_main_question_value js_main_question_input' contenteditable='true'></div>
<input type="email" class="p20 subtle_border question_wrapper_content email_input js_main_email_value" placeholder='Enter your email here'>
<div class="g-recaptcha mt10" data-sitekey="6LcIo9oSAAAAAPTdolZGu6RoMDybW0Q66-TLTkbV"></div>
</div>
<div class="everyOtherGreenButton inline_middle question_wrapper_content submit_main_question js_submit_main_question center_align">ASK ME NOW</div>
<div class="everyOtherGreenButton inline_middle question_wrapper_content sending_main_question js_sending_main_question center_align noafter">SENDING...</div>
<div class='inline_middle bold question_wrapper_content response_message question_sent_success js_question_sent_success'>Success! You will receive an email when Kavita answers the question. :D</div>
<div class='inline_middle bold question_wrapper_content response_message question_sent_error js_question_sent_error'>There was an unknown error :( Please try again or refresh the page.</div>
</div>
<div class="question_wrapper main_content_content homepage_section">
<div class='big_heading'>Recently answered questions</div>
<div class="recently_answered_wrapper">
<?php
include 'includes/database_login.inc';
$sql_query = "SELECT * FROM posts WHERE published = 1 and deleted = 0 and answered = 1 ORDER BY answered_on DESC LIMIT 5";
$result = mysqli_query($conn, $sql_query);
echo $result->num_rows;
$rowCount = '2';
echo $rowCount;
$p_index = 0;
while($row = mysqli_fetch_assoc($result)) {
?><a href='/post.php?id=<?php echo $row["id"]; ?>' class="recently_answered_wrapper_content recently_answered_question inline_middle subtle_border recent<?php echo $p_index%4; ?>">
<div class="title p10 bold">Q. <?php echo $row['title']; ?></div>
<div class="answer p10" style='padding-top: 0'><?php echo $row['answer']; ?></div>
</a><?php //$p_index++;
}
$conn->close(); ?><a href='/posts.php' class="recently_answered_wrapper_content recently_answered_question noborder view_all_answered_questions inline_middle center_align">
<div class="p10 bold" style="margin-top: 55px;">VIEW ALL ANSWERS</div>
</a>
</div>
</div>
</div>