|
|
|
...............ทำอย่างไรให้เห็น เฉพาะข่าวของตัวเองครับ....... |
|
|
|
|
|
|
|
listdata.php
Code (PHP)
<?
session_start();
include ("connect.php");
if($_SESSION['memid'] == "")
{
echo "Please Login!";
exit();
}
if($_SESSION['Status'] != "USER")
{
echo "This page for User only!";
exit();
}
$strSQL = "SELECT * FROM tblmember WHERE memid = '".$_SESSION['memid']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title></title>
<script type="text/javascript" src="scripts/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<link rel="stylesheet" href="style/style.css" />
<script type="text/javascript">
$(document).ready(function() {
$('a[id^="edit"]').fancybox({
'width' : '50%',
'height' : '50%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
onClosed : function() {
parent.location.reload(true);
}
});
$('a[id^="delete"]').fancybox({
'width' : '20%',
'height' : '20%',
onStart : function() {
return window.confirm('คุณต้องลบหรือไม่ ??');
},
onClosed : function() {
parent.location.reload(true);
}
});
/*
onStart : function() {
return window.confirm('Continue?');
},
onCancel : function() {
alert('Canceled!');
},
onComplete : function() {
alert('Completed!');
},
onCleanup : function() {
return window.confirm('Close?');
},
onClosed : function() {
alert('Closed!');
}
*/
});
</script>
</head>
<body>
<?
$strSQL = "SELECT * FROM tb_news ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<div align="center">
<table width="600" border="0" align="center">
<tr>
<th width="91"> <div align="center">หัวข้อข่าว </div></th>
<th width="98"> <div align="center">รายละเอียด</div></th>
<th width="30"> <div align="center">Edit </div></th>
<th width="30"> <div align="center">Delete </div></th>
</tr>
<?
$i=0;
while($objResult = mysql_fetch_array($objQuery))
{
$i++;
?>
<tr>
<td><div align="center"><?=$objResult["title_news"];?></div></td>
<td><?=$objResult["detail_news"];?></td>
<td align="center"><a id="edit<?=$i;?>" class="various iframe" href="editform.php?CusID=<?=$objResult["id_news"];?>">Edit</a></td>
<td align="center"><a id="delete<?=$i;?>" class="various iframe" href="delete.php?CusID=<?=$objResult["id_news"];?>">Delete</a></td>
</tr>
<?
}
?>
</table>
<p><a href="home.php">Home</a></p>
</div>
<?
mysql_close();
?>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2012-05-06 17:36:21 |
By :
birdkak |
View :
1365 |
Reply :
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไฟลเพิ่มข่าวครับ
Code (PHP)
<?
session_start();
include ("connect.php");
if($_SESSION['memid'] == "")
{
echo "Please Login!";
exit();
}
if($_SESSION['Status'] != "USER")
{
echo "This page for User only!";
exit();
}
$strSQL = "SELECT * FROM tblmember WHERE memid = '".$_SESSION['memid']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<!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" />
<title></title>
</head>
<body>
<?
$strSQL = "INSERT INTO tb_news ";
$strSQL .="(title_news,detail_news,memid) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txttitle"]."','".$_POST["txtdetail"]."','".$_POST["memid"]."') ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo("<script> alert('บันทึกเรียบร้อยค่ะ!')</script>");
print "<meta http-equiv=refresh content=0;URL=home.php>";
}
else
{
echo "Error Save [".$strSQL."]";
}
mysql_close();
?>
<body>
</body>
</html>
|
|
|
|
|
Date :
2012-05-06 17:37:06 |
By :
birdkak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code
-- phpMyAdmin SQL Dump
-- version 2.10.3
-- http://www.phpmyadmin.net
--
-- โฮสต์: localhost
-- เวลาในการสร้าง: 06 พ.ค. 2012 น.
-- รุ่นของเซิร์ฟเวอร์: 5.0.51
-- รุ่นของ PHP: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- ฐานข้อมูล: `memberdb`
--
-- --------------------------------------------------------
--
-- โครงสร้างตาราง `tblcatmember`
--
CREATE TABLE `tblcatmember` (
`catid` int(5) NOT NULL auto_increment,
`catname` varchar(50) NOT NULL,
`catactive` int(1) NOT NULL default '1',
PRIMARY KEY (`catid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- dump ตาราง `tblcatmember`
--
INSERT INTO `tblcatmember` VALUES (1, '¼Ùéãªé', 1);
INSERT INTO `tblcatmember` VALUES (2, 'à¡ÃÕ¹', 1);
-- --------------------------------------------------------
--
-- โครงสร้างตาราง `tblmember`
--
CREATE TABLE `tblmember` (
`memid` int(5) NOT NULL auto_increment,
`mem_fullname` varchar(50) NOT NULL,
`mem_email` varchar(50) NOT NULL,
`mem_username` varchar(30) NOT NULL,
`mem_password` varchar(50) NOT NULL,
`catid` int(5) NOT NULL,
`Status` enum('USER') character set utf8 collate utf8_unicode_ci NOT NULL default 'USER',
PRIMARY KEY (`memid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
--
-- dump ตาราง `tblmember`
--
INSERT INTO `tblmember` VALUES (1, 'sdfga', '[email protected]', 'qwe', '1234', 0, 'USER');
INSERT INTO `tblmember` VALUES (2, 'wichita', '[email protected]', 'bim', '1234', 1, 'USER');
INSERT INTO `tblmember` VALUES (3, 'ÍÕàºÃÔ´', '5ffjjkfkl@èhotmail.com', 'biii', '1234', 2, 'USER');
INSERT INTO `tblmember` VALUES (4, 'bird', '[email protected]', 'birdkak', '1234', 2, 'USER');
-- --------------------------------------------------------
--
-- โครงสร้างตาราง `tb_news`
--
CREATE TABLE `tb_news` (
`id_news` int(11) NOT NULL auto_increment,
`memid` int(11) unsigned default NULL,
`title_news` varchar(200) NOT NULL,
`detail_news` text NOT NULL,
PRIMARY KEY (`id_news`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;
--
-- dump ตาราง `tb_news`
--
INSERT INTO `tb_news` VALUES (1, 1, 'เทสน๊ะจ๊ะ', 'ข่าวๆๆเด็ดๆ แจ่มจันทร์ฮะ555 ');
INSERT INTO `tb_news` VALUES (7, 0, 'แดเดป้', '้่ด้ดปปดป');
INSERT INTO `tb_news` VALUES (4, 0, 'พพ', 'พพ');
INSERT INTO `tb_news` VALUES (5, 0, '55555555555', '555555555555');
INSERT INTO `tb_news` VALUES (6, 0, 'เทสครั้งสุดท้าย', 'อะจึ๊ยๆๆ');
INSERT INTO `tb_news` VALUES (8, 0, '555555555555555555555', '55555555555');
INSERT INTO `tb_news` VALUES (9, 0, '8888888888', '88888888888');
INSERT INTO `tb_news` VALUES (10, 0, 'โหลๆๆ', '555');
INSERT INTO `tb_news` VALUES (13, NULL, 'งจยจตนย', 'ยนยน');
INSERT INTO `tb_news` VALUES (14, 0, 'เทสสสสสสสสสสสสส', 'กด54เ1ด54้ด56ก');
INSERT INTO `tb_news` VALUES (15, 0, 'ัึีดัีรรด', 'ัรดัั');
|
|
|
|
|
Date :
2012-05-06 17:38:58 |
By :
birdkak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รบกวนด้วยครับ อิอิ
|
|
|
|
|
Date :
2012-05-06 17:39:26 |
By :
birdkak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันดึงมาไม่ได้อ่ะครับ เพราะตอน add ข่าวเข้าไป ค่า memid มันเป็นค่า 0 อ่ะครับ ทุก Id เลยพี่
อันนี้ไฟล์ add ครับ
Code (PHP)
<?
session_start();
include ("connect.php");
if($_SESSION['memid'] == "")
{
echo "Please Login!";
exit();
}
if($_SESSION['Status'] != "USER")
{
echo "This page for User only!";
exit();
}
$strSQL = "SELECT * FROM tblmember WHERE memid = '".$_SESSION['memid']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<!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" />
<title></title>
</head>
<body>
<?
$strSQL = "INSERT INTO tb_news ";
$strSQL .="(title_news,detail_news,memid) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txttitle"]."','".$_POST["txtdetail"]."','".$_POST["memid"]."') ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo("<script> alert('บันทึกเรียบร้อยค่ะ!')</script>");
print "<meta http-equiv=refresh content=0;URL=home.php>";
}
else
{
echo "Error Save [".$strSQL."]";
}
mysql_close();
?>
<body>
</body>
</html>
|
|
|
|
|
Date :
2012-05-08 11:41:48 |
By :
birdkak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วครับ ขอขอบพระคุณ พี่วินมากครับ
|
|
|
|
|
Date :
2012-05-08 12:37:44 |
By :
birdkak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2012-05-08 13:21:45 |
By :
acnesta23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|