สอบถามครับ

เริ่มโดย ichat-8, 26 กันยายน 2018, 15:03:22

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

ichat-8


สอบถามครับ แบบนี้แก้ยังไงครับ พอเอาไปUpขึ้นโอสแล้วเป้นแบบนี้


ส่วนนี้ลองที่ Localhost


maneemeena

php เวอร์ชั่นใหม่ๆ ไม่รองรับ shorttag <?  ?> แบบนี้แล้วครับ
เปลี่ยนไปใช้ <?php ?> แบบนี้แทนครับ

ichat-8

<?php require_once('admin/config.php');
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--เรียกไฟล์ ckeditor -->
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<!--จบการเรียกไฟล์ ckeditor -->

<title>แจ้งร้องเรียน</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
window.onload=function(){
var tfrow = document.getElementById('tfhover').rows.length;
var tbRow=[];
for (var i=1;i<tfrow;i  ) {
tbRow[i]=document.getElementById('tfhover').rows[i];
tbRow[i].onmouseover = function(){
  this.style.backgroundColor = '#ffffff';
};
tbRow[i].onmouseout = function() {
  this.style.backgroundColor = '#d4e3e5';
};
}
};
</script>
</head>
<body>
<div id="wrapper">
<?php require_once('header.php'); ?>
<?php require_once('menu.php'); ?>
<div id="contentwrap">
<div id="newstbl">
    <center><h1>แจ้ง ร้องเรียน</h1></center>
   
   
   <form name="frmMain" class="semantic" method="POST"  action="save-complaint.php" onSubmit="return validateForm()">
 
  <fieldset>
   
    <legend>กรุณากรอกข้อมูลร้องเรียนให้ครบถ้วน</legend>
   
    <div>
    <?
    $a = "ID";
$b = date("YmdHis");
?>
      <label>รหัสการแจ้ง :</label>
      <input type="text" name="txtcode" readonly="readonly" value="<?echo$a.$b;?>" size="50"> *ใช้สำหรับการตรวจสอบสถานะการแจ้ง
    </div>
    <div>
      <label>ประเภทการแจ้ง :</label>
      <select name="txtcategory" onChange ="JavaScript:ListContact(this.value);">
         
          <?
$sql="SELECT * FROM tblcategory_complaint";
$result=mysql_query($sql);
$num_rows=mysql_num_rows($result);

while($row=mysql_fetch_array($result))
{
$category_id = $row["category_id"];
$category_name = $row["category_name"];

echo "<option value="".$category_id."">".$category_name."</option>";

}
?>
        </select>
     
    </select>
    </div>
    <div>
      <label></label>
      <input type="hidden" name="txtname" value="<? echo $_SESSION["MemberID"]; ?>" size="60">
    </div>
    <div>
      <label>รายละเอียด :</label>
      <textarea class="ckeditor" name="txtdes"></textarea>
    </div>   
   
   
<div>
<label></label>
   <input type="submit" value="ส่งคำร้อง" />
</div>
  </fieldset> 
  </form>

</div>
</div>
<?php require_once('footer.php'); ?>
</div>
</body>
</html>



ปรับตรงส่วนไหนครับ

jirawatcmru

เปลี่ยนรูปแบบการเขียนเป็น PHP V.7 เป็น mysqli ครับลองศึกษาตรง  php.ini ดูครับว่าวิธีเขียนเป็นรูปแบบเขียนได้อย่างไรยกตัวอย่างการเขียน query ถ้าเดาไม่ผิดเจ้าของกระทู้ เขียนแบบนี้เวอร์ชั่นเดิม . $rows=mysql_db_query ถ้าจะ query เวอร์ชั่น 7. ต้องปรับมาใช้เป็น mysqli_query .....ว่าไปครับ ลองเช็คบน Host ใช้ PHP เวอร์ชั่นไหนครับ

maneemeena

อ้างถึงจาก: ichat-8 ใน 26 กันยายน 2018, 15:42:16
<?php require_once('admin/config.php');
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--เรียกไฟล์ ckeditor -->
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<!--จบการเรียกไฟล์ ckeditor -->

<title>แจ้งร้องเรียน</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
window.onload=function(){
var tfrow = document.getElementById('tfhover').rows.length;
var tbRow=[];
for (var i=1;i<tfrow;i  ) {
tbRow[i]=document.getElementById('tfhover').rows[i];
tbRow[i].onmouseover = function(){
  this.style.backgroundColor = '#ffffff';
};
tbRow[i].onmouseout = function() {
  this.style.backgroundColor = '#d4e3e5';
};
}
};
</script>
</head>
<body>
<div id="wrapper">
<?php require_once('header.php'); ?>
<?php require_once('menu.php'); ?>
<div id="contentwrap">
<div id="newstbl">
    <center><h1>แจ้ง ร้องเรียน</h1></center>
   
   
   <form name="frmMain" class="semantic" method="POST"  action="save-complaint.php" onSubmit="return validateForm()">
 
  <fieldset>
   
    <legend>กรุณากรอกข้อมูลร้องเรียนให้ครบถ้วน</legend>
   
    <div>
    <?
    $a = "ID";
$b = date("YmdHis");
?>
      <label>รหัสการแจ้ง :</label>
      <input type="text" name="txtcode" readonly="readonly" value="<?echo$a.$b;?>" size="50"> *ใช้สำหรับการตรวจสอบสถานะการแจ้ง
    </div>
    <div>
      <label>ประเภทการแจ้ง :</label>
      <select name="txtcategory" onChange ="JavaScript:ListContact(this.value);">
         
          <?
$sql="SELECT * FROM tblcategory_complaint";
$result=mysql_query($sql);
$num_rows=mysql_num_rows($result);

while($row=mysql_fetch_array($result))
{
$category_id = $row["category_id"];
$category_name = $row["category_name"];

echo "<option value="".$category_id."">".$category_name."</option>";

}
?>
        </select>
     
    </select>
    </div>
    <div>
      <label></label>
      <input type="hidden" name="txtname" value="<? echo $_SESSION["MemberID"]; ?>" size="60">
    </div>
    <div>
      <label>รายละเอียด :</label>
      <textarea class="ckeditor" name="txtdes"></textarea>
    </div>   
   
   
<div>
<label></label>
   <input type="submit" value="ส่งคำร้อง" />
</div>
  </fieldset> 
  </form>

</div>
</div>
<?php require_once('footer.php'); ?>
</div>
</body>
</html>



ปรับตรงส่วนไหนครับ

ตรงไหนที่เป็น <? ก็แก้เป็น <?php แค่นี้ครับ