|
|
|
ช่วยสอนหน่อยครับ การแสดงข้อมูล ครับ ไม่รู้จะทำอย่างไรแล้วครับ |
|
|
|
|
|
|
|
อยากทราบการนำเอาข้อมูลขึ้นมาแสดง อยากให้เหมือนกับที่เอาพิมพ์เข้าในหน้ากรอก นะครับครับ เช่น
เราพิมพ์
1. ข้อความ
2. ข้อความ
3. ข้อความ
แต่เวลาแสดงกลับเป็น
1. ข้อความ 2. ข้อความ 3. ข้อความ
ไม่รู้จะแก้ไขอย่างไรนะ
และเวลาเอาดูแล้วอยากให้มันอัพเดทว่ามีคนดูเท่าไหร่ ต้องทำอย่างไรครับ
ไฟล์ save.php
<?
require("connectdata.php");
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<meta http-equiv="refresh" content="2;URL=showjob.php">
</head>
<body>
<?
$connect= mysql_connect( $host,$username,$password) or die ("ไม่สามารถติดต่อข้อมูลได้ ");
mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได");
{
mysql_query("INSERT INTO $tb (title, message, name, email, tel, date) values('$title', '$message', '$name', '$email', '$tel', '$date ')") or die ("Add ข้อมูลลง Table ไม่ได้ ");
}
mysql_close($connect);
?>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><?echo "Add ข้อมูลลง Table เสร็จเรียบร้อยแล้ว";
?></div></td>
</tr>
</table>
</body>
</html>
ไฟล์แสดง view.php
<?php require_once('../Connections/connect.php'); ?>
<?php
mysql_select_db($database_connect, $connect);
$query_vi = "SELECT * FROM jobs";
$vi = mysql_query($query_vi, $connect) or die(mysql_error());
$row_vi = mysql_fetch_assoc($vi);
$totalRows_vi = mysql_num_rows($vi);
$date=Date("h:ia (j/m/Y)");
mysql_close();
?>
<html>
<head>
<title>THAIDEV :
<?=$boardtitle?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="robots" content="all">
<style type="text/css">
<!--
body { margin: 0px 0px; padding: 0px 0px}
a:link { color: #336600; text-decoration: none}
a:visited { color: #336600; text-decoration: none}
a:active { color: #336600; text-decoration: underline}
a:hover { color: #0099FF; text-decoration: underline}
-->
</style>
<style>
@media all { IE\:HOMEPAGE {behavior:url(#default#homepage)} }
TD {
FONT-SIZE: 10pt; COLOR: #000000; FONT-FAMILY: MS Sans Serif, Tahoma
}
td { font-family: MS Sans Serif, Microsoft Sans Serif; font-size: 10pt }
TABLE {
empty-cells: show
}
.bordercolor {
FONT-SIZE: 10pt; FONT-FAMILY: MS Sans Serif, Tahoma, thonburi; BACKGROUND-COLOR: #6394bd
}
.windowbg2 {
FONT-SIZE: 10pt; COLOR: #000000; FONT-FAMILY: MS Sans Serif, Tahoma, thonburi; BACKGROUND-COLOR: #f8f8f8
}
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000066" vlink="#000099" alink="#006600">
<center>
<table width="550" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%">ตำแหน่งงานว่าง </td>
<td width="80%"><?php echo $row_vi['title']; ?></td>
</tr>
<tr>
<td>รายละเอียด</td>
<td><?php echo $row_vi ['message']; ?></td>
</tr>
<tr>
<td>ชื่อ ผู้ติดต่อ</td>
<td><?php echo $row_vi['name']; ?></td>
</tr>
<tr>
<td>เบอร์ติดต่อ</td>
<td><?php echo $row_vi['tel']; ?></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="22">
<div align="right">บันทึกโดย <?php echo $row_vi['name']; ?> เมื่อ <?php echo $row_vi['date']; ?> อ่าน <?php echo $row_vi['view']; ?> </div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<p align="left">
</center>
</body>
</html>
<?php
mysql_free_result($vi);
?>
Tag : - - - -
|
|
|
|
|
|
Date :
22 พ.ย. 2550 18:26:16 |
By :
ต้น |
View :
1370 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอ ตรงให้มันขึ้นบรรทัดใหม่นี่ต้องรอให้ผู้รู้มาตอบอะค่ะ รู้แต่วิธีคิดไม่รู้วิธีทำ T T น่าจะประมาณว่าพอเคาะ Enter ให้เก็บแทก <br> มาด้วยประมาณนั้น
แต่ตรงเก็บจำนวนคนดูพอแนะนำได้
ก็ให้เพิ่มฟิดล์ ในฐานข้อมูล ชื่ออาจจเป็น totalview ก็ได้ค่ะ
แล้วในหน้าที่จะเช็คคนดูก็ใส่ script
---------
session_start();
//$mid ก็คือ id ของpage หรือของข่าว หรือของอะไรก็แล้วแต่ที่เราจะเก็บค่า view อะค่ะ
if(session_is_registered("ncount$mid")){}
else{
$ncount=1;
session_register("ncount$mid");
$sql = "UPDATE alu_members SET TotalView=TotalView+1, LastView=NOW() WHERE ID = '".$mid."' ";
mysql_query($sql);
}
|
|
|
|
|
Date :
23 พ.ย. 2550 14:53:46 |
By :
hobbits |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
โอ๊ะ ดันก๊อบมาทั้งดุ้นเลย ตรง update ฐานข้อมูล ขออภัยค่ะ - * -
$sql = "UPDATE $table SET totalview=totalview+1 WHERE ID = '".$mid."' ";
|
|
|
|
|
Date :
23 พ.ย. 2550 14:55:35 |
By :
hobbits |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|