|
 |
|
รบกวนดูโด้ค php ให้หน่อย ครับท่านกูรู งม มาหลายวันล่ะ |
|
 |
|
|
 |
 |
|
รบ กวนกูรู ช่วยดูโค้นให้หน่อยครับ
1.ทำอย่างไร ตาราง member (UserID) กับ customer (Cus_ID)ถึงจะเป็นคนคนเดียวกัน เวลาล็อกอินเข้ามาครับ
2.เวลาบันทึก แล้วlogout user อื่น มาบันทึก ทำไมถึงยังจำ user เก่าอยู่อะครับ
3.หน้า edit book กับ view ยังออกรายงานผิดๆ ยุ
Link web ตัวอย่าง ครับ
http://www.servcares.com:8088/servcare/index.html
DB
member

cutomer

book

code php
page user from
Code (PHP)
<?
session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
include("connect.php");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$strSQL = "SELECT * FROM member WHERE UserID = '".$_SESSION['UserID']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<html>
<head>
<title>Customer - User Page | ServCare Solutions</title>
<meta name="description" content="Place your description here">
<meta name="keywords" content="put, your, keyword, here">
<meta name="author" content="Templates.com - website templates provider">
<meta charset="utf-8">
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/layout.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="js/script.js"></script>
<!--[if lt IE 7]>
<link rel="stylesheet" href="css/ie6.css" type="text/css" media="screen">
<script type="text/javascript" src="js/ie_png.js"></script>
<script type="text/javascript">
ie_png.fix('.png');
</script>
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<![endif]-->
</head>
<body id="page2">
<div class="tail-bottom">
<div id="main">
<!-- header -->
<header>
<div class="nav-box">
<nav>
<ul class="fright">
<li><a href="index.html"><img src="images/pic-home.gif"></a></li>
<li><a href="contact-us.html"><img src="images/pic-mail.gif"></a></li>
<li><a href="sitemap.html"><img src="images/pic-sitemap.gif"></a></li>
</ul>
<ul>
<li><a href="index.html">home</a></li>
<li><a href="service.html">Sevice บริการ</a></li>
<li><a href="branch.html">Branch สาขาของเรา</a></li>
<li><a href="about-us.html">About</a></li>
<li><a href="contact-us.html">Contacts</a></li>
</ul>
</nav>
</div>
<form name="form1" method="post" action="check_login.php"><br>
<h2><span>Welcome</span> to ServCare Solutions Booking! </h2><p></p>
<table border="1" style="width: 300px">
<tbody>
<tr>
<td width="87"> Username</td>
<td width="197"><?=$objResult["Username"];?>
</td>
</tr>
<tr>
<td> Name</td>
<td><?=$objResult["Name"];?>
</td>
</tr>
</tbody>
</table>
<br>
<a href="edit_profile.php"><b>Edit Profile</b></a> <a href="logout.php"><b>Logout</b></a><br></form>
<form name="form1" method="post" action="save_booking.php"><br>
<p><b>Booking Data</b></p>
<table width="800" border="1" style="width: 800px">
<tbody>
<p><a href="edit_booking.php"><b>Edit Booking</b></a> </p>
<tr><p>
<td width="125"> ชื่อ - นามสกุล (Name)</td>
<td width="180">
<input name="txtCus_name" type="text" id="txtCus_name" size="20">
</p></td>
</tr>
<tr><p>
<td> ที่อยู่ผู้ส่งซ่อม (Address)</td>
<td><textarea name="txtAddress" type="text" id="txtAddress" size="200"></textarea>
</p></td>
</tr>
<tr><p>
<td> เบอร์ติดต่อกลับ (Contact number)</td>
<td><input name="txtPhone_no" type="text" id="txtPhone_no">
page save
<?
mysql_connect("localhost","root","Banana1234");
mysql_select_db("servcare");
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."'
and Password = '".trim($_POST['txtPassword'])."'";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
if(trim($_POST["txtCus_name"]) == "")
{
echo "Please input Name!";
exit();
}
if(trim($_POST["txtPhone_no"]) == "")
{
echo "Please input Phone Number!";
exit();
}
if(trim($_POST["txtEmail"]) == "")
{
echo "Please input Email!";
exit();
}
else
{
$strSQL1 = "SELECT max(UserID) as id from member ";
$objQuery = mysql_query($strSQL1);
while($row = mysql_fetch_array($objQuery)){
$UserID = $row[id];
}
$strSQL1 = "INSERT INTO customer ";
$strSQL1 .="(UserID,Cus_name,Address,Phone_no,Convenience,Branch,Email) ";
$strSQL1 .="VALUES ";
$strSQL1 .="(".$UserID.",'".$_POST["txtCus_name"]."','".$_POST["txtAddress"]."','".$_POST["txtPhone_no"]."' ";
$strSQL1 .=",'".$_POST["txtConvenience"]."','".$_POST["ddlBranch"]."','".$_POST["txtEmail"]."') ";
$objQuery = mysql_query($strSQL1);
$strSQL2 = "SELECT max(cus_id) as id from customer ";
$objQuery = mysql_query($strSQL2);
while($row = mysql_fetch_array($objQuery)){
$cus_id = $row[id];
}
$strSQL2 = "INSERT INTO book ";
$strSQL2 .="(Cus_ID,Type,Model,Imei1,Imei2,Serial_no,Symptom1,Symptom2,Remark,Attach_file) ";
$strSQL2 .="VALUES ";
$strSQL2 .="(".$cus_id.",'".$_POST["ddlType"]."','".$_POST["txtModel"]."','".$_POST["txtImei1"]."' ";
$strSQL2 .=",'".$_POST["txtImei2"]."','".$_POST["txtSerial_no"]."','".$_POST["txtSymptom1"]."' ";
$strSQL2 .=",'".$_POST["txtSymptom2"]."','".$_POST["txtRemark"]."','".$_POST["bobAttach_file"]."') ";
$objQuery = mysql_query($strSQL2);
echo "Booking Completed!<br>";
echo "<br> Go to <a href='index.html'>Home page</a><p>";
echo "<br> Go to <a href='edit_booking.php'>Edit Booking page</a>";
echo "<br> Go to <a href='view_booking.php'>view Booking page</a>";
}
mysql_close();
?>
ขอบคุน น่ะ ครับ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2012-05-15 15:12:22 |
By :
BeginPHPs |
View :
1174 |
Reply :
6 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ไขหน้า user page อันแรกผิดครับ
Code (PHP)
?>
<html>
<head>
<title>Customer - User Page | ServCare Solutions</title>
<meta name="description" content="Place your description here">
<meta name="keywords" content="put, your, keyword, here">
<meta name="author" content="Templates.com - website templates provider">
<meta charset="utf-8">
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/layout.css" type="text/css" media="all" />
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="js/script.js"></script>
<!--[if lt IE 7]>
<link rel="stylesheet" href="css/ie6.css" type="text/css" media="screen">
<script type="text/javascript" src="js/ie_png.js"></script>
<script type="text/javascript">
ie_png.fix('.png');
</script>
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<![endif]-->
</head>
<body id="page2">
<div class="tail-bottom">
<div id="main">
<!-- header -->
<header>
<div class="nav-box">
<nav>
<ul class="fright">
<li><a href="index.html"><img src="images/pic-home.gif"></a></li>
<li><a href="contact-us.html"><img src="images/pic-mail.gif"></a></li>
<li><a href="sitemap.html"><img src="images/pic-sitemap.gif"></a></li>
</ul>
<ul>
<li><a href="index.html">home</a></li>
<li><a href="service.html">Sevice บริการ</a></li>
<li><a href="branch.html">Branch สาขาของเรา</a></li>
<li><a href="about-us.html">About</a></li>
<li><a href="contact-us.html">Contacts</a></li>
</ul>
</nav>
</div>
<form name="form1" method="post" action="check_login.php"><br>
<h2><span>Welcome</span> to ServCare Solutions Booking! </h2><p></p>
<table border="1" style="width: 300px">
<tbody>
<tr>
<td width="87"> Username</td>
<td width="197"><?=$objResult["Username"];?>
</td>
</tr>
<tr>
<td> Name</td>
<td><?=$objResult["Name"];?>
</td>
</tr>
</tbody>
</table>
<br>
<a href="edit_profile.php"><b>Edit Profile</b></a> <a href="logout.php"><b>Logout</b></a><br></form>
<form name="form1" method="post" action="save_booking.php"><br>
<p><b>Booking Data</b></p>
<table width="800" border="1" style="width: 800px">
<tbody>
<p><a href="edit_booking.php"><b>Edit Booking</b></a> </p>
<tr><p>
<td width="125"> ชื่อ - นามสกุล (Name)</td>
<td width="180">
<input name="txtCus_name" type="text" id="txtCus_name" size="20">
</p></td>
</tr>
<tr><p>
<td> ที่อยู่ผู้ส่งซ่อม (Address)</td>
<td><textarea name="txtAddress" type="text" id="txtAddress" size="200"></textarea>
</p></td>
</tr>
<tr><p>
<td> เบอร์ติดต่อกลับ (Contact number)</td>
<td><input name="txtPhone_no" type="text" id="txtPhone_no">
</p></td>
</tr>
<tr><p>
<td> ช่วงเวลาติดต่อกลับ</td>
<td><input name="txtConvenience" type="text" id="txtConvenience" size="30">
</p></td>
</tr>
<tr><p>
<td> สาขาที่ท่านสะดวกส่งซ่อม</td>
<td>
<select name="ddlBranch" id="ddlBranch">
<option value="Fashion">Fashionisland(แฟชั่น)</option>
<option value="RamaII">Cental RAMAII(พระราม2)</option>
<option value="Other">Other(อื่นๆ)</option>
</select>
</p></td>
</tr>
<tr><p>
<td> Email</td>
<td><input name="txtEmail" type="text" id="txtEmail" size="30">
</p></td>
</tr>
<tr><p>
<td> ประเภทอุปกรณ์ที่ส่งซ่อม (Device)</td>
<td>
<select name="ddlType" id="ddlType">
<option value="SmartPhone">Smart Phone(สมาร์ทโฟน)</option>
<option value="Tablet">Tablet(แท็บเล็ต)</option>
<option value="Other">Other(อื่นๆ)</option>
</select>
</p></td>
</tr>
<tr><p>
<td> ชื่อรุ่น(Model)ด้านหลังเครื่อง</td>
<td><input name="txtModel" type="text" id="txtModel" size="30" >
</p></td>
</tr>
<tr><p>
<td> หมายเลยเครื่อง IMEI 1</td>
<td><input name="txtImei1" type="text" id="txtImei1" size="15">
</p></td>
</tr>
<tr><p>
<td> หมายเลยเครื่อง IMEI 2</td>
<td><input name="txtImei2" type="text" id="txtImei2" size="15">
</p></td>
</tr>
<tr><p>
<td> หมายเลข S/N ด้านหลังเครื่อง</td>
<td><input name="txtSerial_no" type="text" id="txtSerial_no" size="15">
</p></td>
</tr>
<tr><p>
<td> อาการเสีย 1 (symptom 1)</td>
<td><input name="txtSymptom1" type="text" id="txtSymptom1" size="40">
</p></td>
</tr>
<tr><p>
<td> อาการเสีย 2 (symptom 1)</td>
<td><input name="txtSymptom2" type="text" id="txtSymptom2" size="40">
</p></td>
</tr>
<tr><p>
<td> หมายเหตุ (Remark)</td>
<td><textarea name="txtRemark" type="text" id="txtRemark" size="400"></textarea>
</p></td>
</tr>
</tbody>
</table>
<br>
<input type="submit" name="Submit" value="Save"></form>
<!-- footer -->
<footer>
<div class="inside">
</div>
<center><img src="images/Picture1.png"></center>
</footer>
</div>
</div>
</body>
</html>
|
 |
 |
 |
 |
Date :
2012-05-15 15:18:50 |
By :
BeginPHPs |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
กำหนดค่าในฐานข้อมูลให้เหมือนกันสิครับ
|
 |
 |
 |
 |
Date :
2012-05-15 15:20:22 |
By :
Dragons_first |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อยากให้กด save มันมาเอง อ่ะ ครับ ลองเล่นดูตาม link อ่ะ ครับ demo
|
 |
 |
 |
 |
Date :
2012-05-15 15:29:41 |
By :
BeginPHPs |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
1.ทำอย่างไร ตาราง member (UserID) กับ customer (Cus_ID)ถึงจะเป็นคนคนเดียวกัน เวลาล็อกอินเข้ามาครับ
==> เปลี่ยนข้อมูล ในตาราง member (UserID) และ customer (Cus_ID) ให้เหมือนกันก่อนครับ
2.เวลาบันทึก แล้วlogout user อื่น มาบันทึก ทำไมถึงยังจำ user เก่าอยู่อะครับ
==> หน้าจะเกี่ยวกับตัวแปร ตัวนี้ครับ $_SESSION['UserID'] ซึ้งผมไม่รู้ว่าตอน หลังจากที่ insert ข้อมูลลง DB เพื่อเก็บ log แล้ว ได้ทำการ ลบค่าในนั้น ด้วยหรือป่าว ครับ
3.หน้า edit book กับ view ยังออกรายงานผิดๆ ยุ
==> เนื่อจาก cutomer(Cus_ID) กับ book (Cus_ID) ข้อมูลไม่เหมือนกัน อ่ะครับ
อันนี้เป็นการวิเคราะห์ของผม หากผิดยังไง ก้ขอโทษด้วยน่ะครับ
ส่วนเรื่อง Code คุณก้ต้องลองนั่งไล่เองน่ะครับ
|
ประวัติการแก้ไข 2012-05-15 16:14:09
 |
 |
 |
 |
Date :
2012-05-15 16:13:31 |
By :
tongjaab |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุนครับ เด๋วลองดูก่อน
|
 |
 |
 |
 |
Date :
2012-05-15 16:18:37 |
By :
BeginPHPs |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Tb >> member

Tb >> customer

กำหนดค่าในฐานข้อมูล ใหม่ แล้ว ยังติด ที่ ตาราง customer เก็บ ค่า UserID ผิดยุครับ :(
เก็บ ค่าคนที่ register ล่าสุด อ่ะ ครับ logout แล้ง login user ใหม่ มา save booking ไม่ยอม save UserID คนที่ ทำการบรรทึก ปัจจุบันครับ รวบกวนอีกรอบ น่ะครับ
|
 |
 |
 |
 |
Date :
2012-05-16 17:09:49 |
By :
BeginPHPs |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|