Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > บทความจากสมาชิก > การสร้างระบบ Booing จองตั๋วหนังอย่างง่าย Ver.2 ด้วยคำส่ัง Session + Array + For Loop แบบง่าย



 
Clound SSD Virtual Server

การสร้างระบบ Booing จองตั๋วหนังอย่างง่าย Ver.2 ด้วยคำส่ัง Session + Array + For Loop แบบง่าย

การสร้างระบบ Booking จองตั๋วหนังอย่างง่าย Ver.2 ด้วยคำส่ัง Session + Array + For Loop แบบง่าย แจกโค๊ดระบบจองตั๋วหนังอย่างง่าย Ver.2
ในการสรั้างที่นั่งจะถุกเก็บไว้ในอาร์เรย์และทำการ loop ซ้อนกัน 2 ครั้งโดยแบ่งเป็น loop นอกสร้างแถวข้อมูลและ loop ในสร้างคอลั่ม และจากนั้นทำการเก็บข้อมูลการสั่งซื้อไว้ที่เซสชั่นและอาร์เรย์และลูปโชว์ออกมา โดยภายในลูปจะมีการกำหนดเงือนไขว่ามีใครสั่งซื้อหรือจองแล้วบ้าง และถ้าเป็นค่าว่างจะทำการเลือกที่นั่งนั้นได้

หน้าเว็บอาจจะไม่สวยนะครับเพราะทำไว้เล่นๆ ไว้สำหรับคนที่ต้องการนำไปต่อยอดเพิ่มเติมเอานะครับ
หน้าเลือกรายการหนัง

001

หน้าเลือกช่วงเวลา

002

หน้าเลือกที่นั่งหนัง

3

การพัฒนาระบบได้ใช้ Dreamweaver Tool

Download Now

Code ทั้งหมด
SQL
-- phpMyAdmin SQL Dump
-- version 2.10.3
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Jan 03, 2014 at 10:41 PM
-- Server version: 5.0.51
-- PHP Version: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

-- 
-- Database: `movie`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `cinema`
-- 

CREATE TABLE `cinema` (
  `c_id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY  (`c_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

-- 
-- Dumping data for table `cinema`
-- 

INSERT INTO `cinema` VALUES (1, 'โรงที่1');
INSERT INTO `cinema` VALUES (2, 'โรงที่22');

-- --------------------------------------------------------

-- 
-- Table structure for table `movie`
-- 

CREATE TABLE `movie` (
  `m_id` int(11) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `pic` varchar(255) NOT NULL,
  PRIMARY KEY  (`m_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

-- 
-- Dumping data for table `movie`
-- 

INSERT INTO `movie` VALUES (1, 'Dragonball', 'http://www.hdwallpapersbank.com/wp-content/uploads/2013/08/Son-Goku-Goku-Dragon-Ball-Z-Fresh-New-hd-Wallpapers.jpg');
INSERT INTO `movie` VALUES (2, 'Doremon', 'http://2.bp.blogspot.com/-qwXiNm_81VA/S6x0YWWG9XI/AAAAAAAAAx0/zG_KT4WvqsQ/s1600/029832.jpg');

-- --------------------------------------------------------

-- 
-- Table structure for table `orders`
-- 

CREATE TABLE `orders` (
  `o_id` int(11) NOT NULL auto_increment,
  `c_id` int(11) NOT NULL,
  `s_id` int(11) NOT NULL,
  `m_id` int(11) NOT NULL,
  `seat_name` varchar(255) NOT NULL,
  `price` varchar(255) NOT NULL,
  PRIMARY KEY  (`o_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=25 ;

-- 
-- Dumping data for table `orders`
-- 

INSERT INTO `orders` VALUES (11, 1, 1, 1, 'I004', '500');
INSERT INTO `orders` VALUES (10, 1, 1, 1, 'E0013', '150');
INSERT INTO `orders` VALUES (9, 1, 1, 1, 'A008', '90');
INSERT INTO `orders` VALUES (12, 1, 3, 1, 'D0014', '103');
INSERT INTO `orders` VALUES (13, 1, 1, 1, 'G0012', '300');
INSERT INTO `orders` VALUES (14, 1, 1, 1, 'G0015', '300');
INSERT INTO `orders` VALUES (15, 1, 3, 1, 'K001', '700');
INSERT INTO `orders` VALUES (16, 1, 2, 2, 'J0013', '600');
INSERT INTO `orders` VALUES (17, 1, 1, 1, 'K0020', '700');
INSERT INTO `orders` VALUES (18, 1, 1, 1, 'I0020', '500');
INSERT INTO `orders` VALUES (19, 1, 1, 1, 'F0018', '200');
INSERT INTO `orders` VALUES (20, 1, 1, 1, 'K0012', '700');
INSERT INTO `orders` VALUES (21, 1, 1, 1, 'D0016', '103');
INSERT INTO `orders` VALUES (22, 1, 1, 1, 'I0017', '500');
INSERT INTO `orders` VALUES (23, 1, 1, 1, 'G0017', '300');
INSERT INTO `orders` VALUES (24, 1, 2, 2, 'D0012', '103');

-- --------------------------------------------------------

-- 
-- Table structure for table `screen`
-- 

CREATE TABLE `screen` (
  `s_id` int(11) NOT NULL auto_increment,
  `m_id` int(11) NOT NULL,
  `c_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `time` time NOT NULL,
  PRIMARY KEY  (`s_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

-- 
-- Dumping data for table `screen`
-- 

INSERT INTO `screen` VALUES (1, 1, 1, '2014-01-03', '23:00:00');
INSERT INTO `screen` VALUES (2, 2, 1, '2014-01-05', '18:00:00');
INSERT INTO `screen` VALUES (3, 1, 1, '2014-05-01', '10:00:00');



index.php
<?php
session_start();
 require_once('Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_movie = 10;
$pageNum_movie = 0;
if (isset($_GET['pageNum_movie'])) {
  $pageNum_movie = $_GET['pageNum_movie'];
}
$startRow_movie = $pageNum_movie * $maxRows_movie;

mysql_select_db($database_conn, $conn);
$query_movie = "SELECT * FROM movie";
$query_limit_movie = sprintf("%s LIMIT %d, %d", $query_movie, $startRow_movie, $maxRows_movie);
$movie = mysql_query($query_limit_movie, $conn) or die(mysql_error());
$row_movie = mysql_fetch_assoc($movie);

if (isset($_GET['totalRows_movie'])) {
  $totalRows_movie = $_GET['totalRows_movie'];
} else {
  $all_movie = mysql_query($query_movie);
  $totalRows_movie = mysql_num_rows($all_movie);
}
$totalPages_movie = ceil($totalRows_movie/$maxRows_movie)-1;

$queryString_movie = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_movie") == false && 
        stristr($param, "totalRows_movie") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_movie = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_movie = sprintf("&totalRows_movie=%d%s", $totalRows_movie, $queryString_movie);
?>
<!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>Untitled Document</title>
<style type="text/css">
body {
	background-color: #000;
	text-align: center;
}
td {
	text-align: center;
}
table {
	text-align: center;
}
</style>
</head>

<body>
<?php if($_SESSION[product]){?>
<?php  unset($_SESSION[price]);
unset($_SESSION[linener]);
unset($_SESSION[product]);
}
?>
<table width="1024" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="img/Untitled-2.jpg" width="1024" height="179" /></td>
  </tr>
  <tr>
    <td height="500" valign="top" bgcolor="#FFFFFF">&nbsp;
      <br />
      <table border="0" align="center" cellpadding="0" cellspacing="0">
             <?php  $i=1;?>
  <?php do { ?>
                  <?php if($i%2==1){?>
          <tr>
             <?php } ?>
            <td width="153"><table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="340"><?php echo $row_movie['title']; ?></td>
              </tr>
              <tr>
                <td><a href="select_time.php?m_id=<?php echo $row_movie['m_id']; ?>"><img src="<?php echo $row_movie['pic']; ?>" width="301" height="253" /></a></td>
              </tr>
            </table></td>
            	<?php if($i%2==0){?>
          </tr>
          	<?php } ?>
	<?php
$i++;
?>
          <?php } while ($row_movie = mysql_fetch_assoc($movie)); ?>
    </table>
    <p>&nbsp;    
    <table border="0">
      <tr>
        <td><?php if ($pageNum_movie > 0) { // Show if not first page ?>
            <a href="<?php printf("%s?pageNum_movie=%d%s", $currentPage, 0, $queryString_movie); ?>"><img src="img/First.gif" /></a>
            <?php } // Show if not first page ?></td>
        <td><?php if ($pageNum_movie > 0) { // Show if not first page ?>
            <a href="<?php printf("%s?pageNum_movie=%d%s", $currentPage, max(0, $pageNum_movie - 1), $queryString_movie); ?>"><img src="img/Previous.gif" /></a>
            <?php } // Show if not first page ?></td>
        <td><?php if ($pageNum_movie < $totalPages_movie) { // Show if not last page ?>
            <a href="<?php printf("%s?pageNum_movie=%d%s", $currentPage, min($totalPages_movie, $pageNum_movie + 1), $queryString_movie); ?>"><img src="img/Next.gif" /></a>
            <?php } // Show if not last page ?></td>
        <td><?php if ($pageNum_movie < $totalPages_movie) { // Show if not last page ?>
            <a href="<?php printf("%s?pageNum_movie=%d%s", $currentPage, $totalPages_movie, $queryString_movie); ?>"><img src="img/Last.gif" /></a>
            <?php } // Show if not last page ?></td>
      </tr>
    </table>
    </p></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC">Design By Webmaster</td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($movie);
?>



select_time.php
<?php 
session_start();
$_SESSION[m_id]=$_GET[m_id];
require_once('Connections/conn.php'); ?>
<?php require_once('Connections/conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_movie = 10;
$pageNum_movie = 0;
if (isset($_GET['pageNum_movie'])) {
  $pageNum_movie = $_GET['pageNum_movie'];
}
$startRow_movie = $pageNum_movie * $maxRows_movie;

$colname_movie = "-1";
if (isset($_GET['m_id'])) {
  $colname_movie = $_GET['m_id'];
}
mysql_select_db($database_conn, $conn);
$query_movie = sprintf("SELECT * FROM movie WHERE m_id = %s", GetSQLValueString($colname_movie, "int"));
$query_limit_movie = sprintf("%s LIMIT %d, %d", $query_movie, $startRow_movie, $maxRows_movie);
$movie = mysql_query($query_limit_movie, $conn) or die(mysql_error());
$row_movie = mysql_fetch_assoc($movie);

if (isset($_GET['totalRows_movie'])) {
  $totalRows_movie = $_GET['totalRows_movie'];
} else {
  $all_movie = mysql_query($query_movie);
  $totalRows_movie = mysql_num_rows($all_movie);
}
$totalPages_movie = ceil($totalRows_movie/$maxRows_movie)-1;

$maxRows_intime = 10;
$pageNum_intime = 0;
if (isset($_GET['pageNum_intime'])) {
  $pageNum_intime = $_GET['pageNum_intime'];
}
$startRow_intime = $pageNum_intime * $maxRows_intime;

mysql_select_db($database_conn, $conn);
$query_intime = "SELECT * FROM screen sn , cinema cn WHERE sn.m_id='$_GET[m_id]' and sn.c_id=cn.c_id";
$query_limit_intime = sprintf("%s LIMIT %d, %d", $query_intime, $startRow_intime, $maxRows_intime);
$intime = mysql_query($query_limit_intime, $conn) or die(mysql_error());
$row_intime = mysql_fetch_assoc($intime);

if (isset($_GET['totalRows_intime'])) {
  $totalRows_intime = $_GET['totalRows_intime'];
} else {
  $all_intime = mysql_query($query_intime);
  $totalRows_intime = mysql_num_rows($all_intime);
}
$totalPages_intime = ceil($totalRows_intime/$maxRows_intime)-1;

$queryString_intime = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_intime") == false && 
        stristr($param, "totalRows_intime") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_intime = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_intime = sprintf("&totalRows_intime=%d%s", $totalRows_intime, $queryString_intime);

$queryString_movie = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_movie") == false && 
        stristr($param, "totalRows_movie") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_movie = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_movie = sprintf("&totalRows_movie=%d%s", $totalRows_movie, $queryString_movie);
?>
<!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>Untitled Document</title>
<style type="text/css">
body {
	background-color: #000;
	text-align: center;
}
td {
	text-align: center;
}
table {
	text-align: center;
}
</style>
</head>

<body>
<table width="1024" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="img/Untitled-2.jpg" width="1024" height="179" /></td>
  </tr>
  <tr>
    <td height="500" valign="top" bgcolor="#FFFFFF">&nbsp;
      <br />
      <table border="0" align="center" cellpadding="0" cellspacing="0">
             <?php  $i=1;?>
  <?php do { ?>
                  <?php if($i%2==1){?>
          <tr>
             <?php } ?>
            <td width="153"><table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="340"><?php echo $row_movie['title']; ?></td>
              </tr>
              <tr>
                <td><img src="<?php echo $row_movie['pic']; ?>" width="301" height="253" /></td>
              </tr>
            </table></td>
            	<?php if($i%2==0){?>
          </tr>
          	<?php } ?>
	<?php
$i++;
?>
          <?php } while ($row_movie = mysql_fetch_assoc($movie)); ?>
    </table>
    <p>&nbsp;    
    เวลาฉาย    
    <p> </p>
    <table border="1" align="center">
      <tr>
        <td width="89">วันที่ฉาย</td>
        <td width="108">เวลาฉาย</td>
        </tr>
      <?php do { ?>
        <?php 
		$date=date("Y-m-d");
		$times=date("H-i-s");
		if($date<=$row_intime['date']){?>
          <tr>
          <td><?php echo $row_intime['date']; ?></td>
          <td><a href="select_screen.php?s_id=<?php echo $row_intime['s_id']; ?>&amp;c_id=<?php echo $row_intime['c_id']; ?>"><?php echo $row_intime['time']; ?></a></td>
          <?php }else{?>
        <?php if($times<=$row_intime['time'] and $date<=$row_intime['date']){?>
        <tr>
          <td><?php echo $row_intime['date']; ?></td>
          <td><a href="select_screen.php?s_id=<?php echo $row_intime['s_id']; ?>&amp;c_id=<?php echo $row_intime['c_id']; ?>"><?php echo $row_intime['time']; ?></a></td>
          <?php }else{?>
             <td><?php echo $row_intime['date']; ?></td>
          <td><?php echo $row_intime['time']; ?></td>
          <?php }}?>
        </tr>
        <?php } while ($row_intime = mysql_fetch_assoc($intime)); ?>
    </table>
    <p>&nbsp;
    <table border="0">
      <tr>
        <td><?php if ($pageNum_intime > 0) { // Show if not first page ?>
            <a href="<?php printf("%s?pageNum_intime=%d%s", $currentPage, 0, $queryString_intime); ?>"><img src="img/First.gif" /></a>
            <?php } // Show if not first page ?></td>
        <td><?php if ($pageNum_intime > 0) { // Show if not first page ?>
            <a href="<?php printf("%s?pageNum_intime=%d%s", $currentPage, max(0, $pageNum_intime - 1), $queryString_intime); ?>"><img src="img/Previous.gif" /></a>
            <?php } // Show if not first page ?></td>
        <td><?php if ($pageNum_intime < $totalPages_intime) { // Show if not last page ?>
            <a href="<?php printf("%s?pageNum_intime=%d%s", $currentPage, min($totalPages_intime, $pageNum_intime + 1), $queryString_intime); ?>"><img src="img/Next.gif" /></a>
            <?php } // Show if not last page ?></td>
        <td><?php if ($pageNum_intime < $totalPages_intime) { // Show if not last page ?>
            <a href="<?php printf("%s?pageNum_intime=%d%s", $currentPage, $totalPages_intime, $queryString_intime); ?>"><img src="img/Last.gif" /></a>
            <?php } // Show if not last page ?></td>
      </tr>
    </table>
    </p></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC">Design By Webmaster</td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($intime);

mysql_free_result($movie);
?>



select_screen.php
<?php session_start();
$_SESSION[c_id]=$_GET[c_id];
$_SESSION[s_id]=$_GET[s_id];
?>
<script>window.location="select_chair.php";</script>


select_chair.php
<?php session_start();?>
<?php 
require_once('Connections/conn.php'); ?>
<?php 

require_once('Connections/conn.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" />
<title>Untitled Document</title>
<style type="text/css">
body {
	background-color: #000;
	text-align: center;
}
td {
	text-align: center;
}
table {
	text-align: center;
}
</style>
</head>

<body>
<table width="1024" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="img/Untitled-2.jpg" width="1024" height="179" /></td>
  </tr>
  <tr>
    <td height="500" valign="top" bgcolor="#FFFFFF"><p>
    </p>
      <p>
        <?php
    $chair=array("0","A","B","C","D","E","F","G","H","I","J","K");
	$pr=array("0","90","100","101","103","150","200","300","400","500","600","700");
	?>
        <?php for($a=1; $a<=count($chair)-1; $a++){?>
        <?php for($b=1; $b<=20; $b++){?>
        <?php $name="$chair[$a]00$b";?>
        <?php $pp=$pr[$a];?>
        <?php
	mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT * FROM orders where seat_name='$name' and c_id='$_SESSION[c_id]' and s_id='$_SESSION[s_id]' and m_id='$_SESSION[m_id]'";
$Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);?>

        <?php if($row_Recordset1 ){?>
        <img src="img/buy.png" width="32" height="32" />
        <?php }else{?>
        <?php if(!$_SESSION[product]){?>
        <a href="order.php?name=<? echo($name);?>&amp;price=<? echo($pp);?>"><img src="img/Magenta-Seat-icon.png" width="32" height="32" /></a>
        <?php }else{?>
        <?php if(in_array("$name",$_SESSION[product])){?>
        <img src="img/check.png" width="32" height="32" />
        <?php }else{?>
        <a href="order.php?name=<? echo($name);?>&amp;price=<? echo($pp);?>"><img src="img/Magenta-Seat-icon.png" width="32" height="32" /></a>
        <?php }}?>
  <?php }?>
  <?php if($b==20){?>
        <?php echo"<br />";?>
        <?php }?>
        <?php }?>
        <?php }?>
    </p>
    <p>&nbsp;</p>
    <fieldset>
      <legend>รายการ      </legend>
      <?php for($x=1; $x<=$_SESSION[linener]; $x++){?>
      <p><?php if(!$_SESSION[product][$x]){?><?php }else{?>
        <img src="img/check.png" width="32" height="32" />ที่นั่งที่ <?php echo($_SESSION[product][$x]);?>
      ราคา <?php echo($_SESSION[price][$x]);?> <a href="del.php?act=<?php echo($x);?>">x</a>     <?php }?> 
      <p><?php }?>      
      <p>
        
        ราคารวม : 
          <?php if(!$_SESSION[product]){?>
          00.00
          <?php }else{?>
          <?php $sum=array_sum($_SESSION[price]);?>    <?php echo number_format(($sum),2);?>  
          <?php }?>
      <p><a href="pay.php">ชำระเงิน</a></p>
 
    </fieldset></td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC">Design By Webmaster</td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

?>



Order.php
<?php
session_start();
$_SESSION[linener]=$_SESSION[linener]+1;
$_SESSION[product][$_SESSION[linener]]=$_GET[name];
$_SESSION[price][$_SESSION[linener]]=$_GET[price];
?>
<script>window.location="select_chair.php";</script>


Del.php
<?php
session_start();
$a=$_GET[act];
unset($_SESSION[product][$a]);
unset($_SESSION[price][$a]);
?>
<script>window.location="select_chair.php";</script>


Pay.php
<?php
session_start();
?>
<?php require_once('Connections/conn.php'); ?>
<?php
for($x=1; $x<=$_SESSION[linener]; $x++){
	if(!$_SESSION[product][$x]){
	}else{
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "insert into orders set s_id='$_SESSION[s_id]',m_id='$_SESSION[m_id]',c_id='$_SESSION[c_id]',price='".$_SESSION[price][$x]."',seat_name='".$_SESSION[product][$x]."'";
$Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
}}
unset($_SESSION[product]);
unset($_SESSION[price]);
unset($_SESSION[linener]);
?>
<script>window.location="index.php";</script>







   
Share
Bookmark.   

  By : 56
  Article : บทความเป็นการเขียนโดยสมาชิก หากมีปัญหาเรื่องลิขสิทธิ์ กรุณาแจ้งให้ทาง webmaster ทราบด้วยครับ
  Score Rating :
  Create Date : 2014-01-04
  Download : No files
Sponsored Links
ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่