2012-11-26 2 views
1

다음 스크립트를 실행하려고하는데 오류보고 기능이 켜져 있어도 흰색 화면 만 표시합니다. 코드를 살펴 보았지만 문제가없는 것 같습니다. 하지만 난 몇 달 동안 PHP를 사용 해왔으므로 나는 당신의 도움에 미리 감사드립니다.데이터베이스 업데이트 문제 - 화이트 스크린

 WHERE id = $ID "; 
mysql_query($query); 

을 그리고 누락 된 세미콜론에있다 :

코드는 다음과 같다 ...

<?php 


error_reporting(E_ALL & ~E_NOTICE); 
ini_set('display_errors', TRUE); 
ini_set('display_startup_errors', TRUE); 


ob_start(); 

function isLoggedIn() 
{ 
    if(isset($_SESSION['valid']) && $_SESSION['valid']) 
     return true; 
    return false; 
} 





session_start(); 
//if the user has not logged in 
if(!isLoggedIn()) 
{ 
    header('Location: ../main'); 

    die(); 
} 



//! Get info from POST 
$cat_name = $_POST['cat_name']; 
$sub_cat_name = $_POST['sub_cat_name']; 
$sub_cat_link = $_POST['sub_cat_link']; 
$item_name = $_POST['item_name']; 
$sub_cat_link_item = $_POST['sub_cat_link_item']; 
$item_price = $_POST['item_price']; 
$item_desc = $_POST['item_desk']; 
$item_link = $_POST['item_link']; 
$ID = $_POST['ID']; 

if (isset($ID)) { 

//! security real escape 

$cat_name = mysql_real_escape_string($cat_name); 
$sub_cat_name = mysql_real_escape_string($sub_cat_name); 
$item_name = mysql_real_escape_string($item_name); 
$sub_cat_link = mysql_real_escape_string($sub_cat_link); 
$sub_cat_link_item = mysql_real_escape_string($sub_cat_link_item); 
$item_price = mysql_real_escape_string($item_price); 
$item_desc = mysql_real_escape_string($item_desc); 
$item_link = mysql_real_escape_string($item_link); 
$ID = mysql_real_escape_string($ID); 

//! Connect to the database 

require_once('../Connections/PropSuite.php'); 
mysql_select_db($database_Takeaway, $Takeaway); 

//! Write the information to the database 

$query = "UPDATE menu_cats 
      SET category_name = '$cat_name', 
       sub_cat_name = '$sub_cat_name', 
       item_name = '$item_name', 
       sub_cat_id_link = '$sub_cat_link', 
       sub_cat_id = '$sub_cat_link_item', 
       item_price = '$item_price', 
       item_desc = '$item_desc', 
       item_link_id = '$item_link' 

      WHERE id = $ID ;" 
mysql_query($query); 



    if(mysql_errno() != 0){ 
    // mysql error 
    // note: message like this should never appear to user, should be only stored in log 
    echo "Mysql error: " . htmlspecialchars(mysql_error()); 
    die(); 
} 

else { 

header('Location: ../main/menu-manager.php?success'); 

} 
} 

else 
{ 
echo("An error occurred!") 
} 
mysql_close(); 

?> 
+0

왜 출력 버퍼를 호출 했나요? 그리고 PHP를 닫은 이유는 무엇입니까? – Ibu

+0

@Ibu 헤더가 이미 전송되었다는 오류가있어서 이전과 같이 출력 버퍼를 사용했고 – AppleTattooGuy

+0

은 모두'?>'를 제거하고 출력 버퍼를 제거하면됩니다. 괜찮다. – Ibu

답변

1
 WHERE id = $ID ;" 
mysql_query($query); 

이 될해야 당신은 출력에

echo("An error occurred!") 
+0

도움을 주셔서 감사합니다 :-) 완벽하게 작동했습니다! – AppleTattooGuy

0

십시오 버퍼링하고 버퍼를 출력하지 않습니다. 따라서 빈 페이지.

관련 문제