|
|
|
แก้ภาษาต่างดาว ????? ยังงัยครับ ให้เป็นภาษาไทย ใช้ utf8 -- UTF-8 Unicode |
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<!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" />
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Customer
</title>
<?php
require_once('auth.php');
?>
<link href="css/bootstrap.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/DT_bootstrap.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link href="../style.css" media="screen" rel="stylesheet" type="text/css" />
<!--sa poip up-->
<script src="jeffartagame.js" type="text/javascript" charset="utf-8"></script>
<script src="js/application.js" type="text/javascript" charset="utf-8"></script>
<link href="src/facebox.css" media="screen" rel="stylesheet" type="text/css" />
<script src="lib/jquery.js" type="text/javascript"></script>
<script src="src/facebox.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({
loadingImage : 'src/loading.gif',
closeImage : 'src/closelabel.png'
})
})
</script>
<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = "" + ((hours >12) ? hours -12 :hours)
if (timeValue == "0") timeValue = 12;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.clock.face.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock() {
stopclock();
showtime();
}
window.onload=startclock;
// End -->
</SCRIPT>
</head>
<?php
function createRandomPassword() {
$chars = "003232303232023232023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$finalcode='RS-'.createRandomPassword();
?>
<body>
<?php include('navfixed.php');?>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li><a href="index.php"><i class="icon-dashboard icon-2x"></i> Dashboard </a></li>
<li><a href="sales.php?id=cash&invoice=<?php echo $finalcode ?>"><i class="icon-shopping-cart icon-2x"></i> Sales </a> </li>
<li><a href="products.php"><i class="icon-list-alt icon-2x"></i> Products</a> </li>
<li class="active"><a href="customer.php"><i class="icon-group icon-2x"></i> Customers </a> </li>
<li><a href="supplier.php"><i class="icon-group icon-2x"></i> Suppliers</a> </li>
<li><a href="salesreport.php?d1=0&d2=0"><i class="icon-bar-chart icon-2x"></i> Sales Report</a> </li>
<br><br><br><br><br><br>
<li>
<div class="hero-unit-clock">
<form name="clock">
<font color="white">Time: <br></font> <input style="width:150px;" type="submit" class="trans" name="face" value="">
</form>
</div>
</li>
</ul>
</div><!--/.well -->
</div><!--/span-->
<div class="span10">
<div class="contentheader">
<i class="icon-group"></i> Customers
</div>
<ul class="breadcrumb">
<li><a href="index.php">Dashboard</a></li> /
<li class="active">Customers</li>
</ul>
<div style="margin-top: -19px; margin-bottom: 21px;">
<a href="index.php"><button class="btn btn-default btn-large" style="float: left;"><i class="icon icon-circle-arrow-left icon-large"></i> Back</button></a>
<?php
include('../connect.php');
$result = $db->prepare("SELECT * FROM customer ORDER BY customer_id DESC");
$result->execute();
$rowcount = $result->rowcount();
?>
<div style="text-align:center;">
Total Number of Customers: <font color="green" style="font:bold 22px 'Aleo';"><?php echo $rowcount;?></font>
</div>
</div>
<input type="text" name="filter" style="padding:15px;" id="filter" placeholder="Search Customer..." autocomplete="off" />
<a rel="facebox" href="addcustomer.php"><Button type="submit" class="btn btn-info" style="float:right; width:230px; height:35px;" /><i class="icon-plus-sign icon-large"></i> Add Customer</button></a><br><br>
<table class="table table-bordered" id="resultTable" data-responsive="table" style="text-align: left;">
<thead>
<tr>
<th width="17%"> Customer ID </th>
<th width="23%"> Customer Name</th>
<th width="10%"> Address </th>
<th width="10%"> Contact Number</th>
<th width="17%"> Note </th>
<th width="14%"> Action </th>
</tr>
</thead>
<tbody>
<?php
include('../connect.php');
$result = $db->prepare("SELECT * FROM customer ORDER BY customer_id DESC");
$result->execute();
for($i=0; $row = $result->fetch(); $i++){
?>
<tr class="record">
<td><?php echo $row['customer_name']; ?></td>
<td><?php echo $row['prod_name']; ?></td>
<td><?php echo $row['address']; ?></td>
<td><?php echo $row['contact']; ?></td>
<td><?php echo $row['note']; ?></td>
<td><a title="Click To Edit Customer" rel="facebox" href="editcustomer.php?id=<?php echo $row['customer_id']; ?>"><button class="btn btn-warning btn-mini"><i class="icon-edit"></i> Edit </button></a>
<a href="#" id="<?php echo $row['customer_id']; ?>" class="delbutton" title="Click To Delete"><button class="btn btn-danger btn-mini"><i class="icon-trash"></i> Delete</button></a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<div class="clearfix"></div>
</div>
</div>
</div>
<script src="js/jquery.js"></script>
<script type="text/javascript">
$(function() {
$(".delbutton").click(function(){
//Save the link in a variable called element
var element = $(this);
//Find the id of the link that was clicked
var del_id = element.attr("id");
//Built a url to send
var info = 'id=' + del_id;
if(confirm("Are you sure want to delete? There is NO undo!"))
{
$.ajax({
type: "GET",
url: "deletecustomer.php",
data: info,
success: function(){
}
});
$(this).parents(".record").animate({ backgroundColor: "#fbc7c7" }, "fast")
.animate({ opacity: "hide" }, "slow");
}
return false;
});
});
</script>
</body>
<?php include('footer.php');?>
</html>
หรือในนี้ครับ
Code (PHP)
<?php
/* Database config */
$db_host = 'localhost';
$db_user = '';
$db_pass = '';
$db_database = '';
/* End config */
$db = new PDO('mysql:host='.$db_host.';dbname='.$db_database, $db_user, $db_pass);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2019-05-22 13:18:47 |
By :
sweerawat |
View :
6415 |
Reply :
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองดูครับ
Code (PHP)
$db->set_charset("utf8");
|
|
|
|
|
Date :
2019-05-22 13:26:38 |
By :
nobetaking |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Notice: Undefined variable: db in C:\xampp\htdocs\partbill_test\connect.php on line 7
Fatal error: Call to a member function set_charset() on null in C:\xampp\htdocs\partbill_test\connect.php on line 7
เออเร่อครับ ใส่ในไฟลื connect.php
|
|
|
|
|
Date :
2019-05-22 13:30:31 |
By :
sweerawat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองแบบนี้ดูครับ
Code (PHP)
<?php
$dsn = 'mysql:host=localhost;dbname=testdb';
$username = 'username';
$password = 'password';
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$dbh = new PDO($dsn, $username, $password, $options);
?>
โทดทีครับพอดีผมไม่ใช้อาจารย์เดียวคนอื่นจะเข้าใจผิด 555
|
|
|
|
|
Date :
2019-05-22 13:38:47 |
By :
nobetaking |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองเข้าไปอ่านดูครับ
https://www.thaicreate.com/php/forum/043302.html
ที่จริงต้องลองดึงข้อมูลออกมาให้ได้สักตัวก่อนครับ ว่ามันโชว์ภาษาไทยหรือป่าว
เหมือนกับว่าเขียนหน้าปล่าวๆ ขึ้นมา
แล้ว query ข้อมูลออกมาว่าแสดงภาษาไทยหรือป่าว
ถ้าแสดงภาษาไทยก็ต้อง ตามแก้ไปเรื่อย ๆ ครับ
ถ้าเอาโปรแกรมสำเร็จรูปของคนอื่นมาน่ะครับ
|
|
|
|
|
Date :
2019-05-22 14:10:00 |
By :
nobetaking |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|