wamp server 2.0 在我注销后丢失了一条记录

wamp server 2.0 loses a record after i log out

我有一个网站,其中包含创建帐户的注册选项。它让我创建一个帐户,然后我登录它。但是在我注销并尝试再次登录后,它告诉我无效的用户名和密码。 Wamp 数据库似乎正在丢失我在注销后创建的 record/account。它也发生在我的其他网站上。我在 Macromedia Dw 8.0 中使用 Wamp 服务器 2.0。也试过 Xampp 但仍然是同样的问题。该站点主要由 Php 和 Mysql 编码组成。 请帮忙。

<?php
$server="localhost";
  $user="root";
$pwd="";
$db="GlobalStyling";
$conn=mysql_connect($server,$user,$pwd) or die(mysql_error());
$sql="drop DATABASE $db";
mysql_query($sql);
$sql="CREATE DATABASE GlobalStyling";
$result=mysql_query($sql) or die ("unable to create database");
mysql_select_db($db) or die(mysql_error()."unable to select database");
 $query1="Create table members
           (
  `member_id` int(11) NOT NULL AUTO_INCREMENT,
  `firstname` varchar(100) NOT NULL,
  `lastname` varchar(100) NOT NULL,
  `middlename` varchar(100) NOT NULL,
  `address` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `contact_no` varchar(100) NOT NULL,
  `age` int(11) NOT NULL,
  `gender` varchar(100) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL,
  PRIMARY KEY (`member_id`)
)";
      $query_run=mysql_query($query1);

$query2="Create table note
    (
  `note_id` int(11) NOT NULL AUTO_INCREMENT,
  `date` varchar(100) NOT NULL,
  `message` varchar(200) NOT NULL,
  PRIMARY KEY (`note_id`)
)";
      $query_run=mysql_query($query2);

$query3="Create table schedule
 (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `member_id` int(11) NOT NULL,
  `date` varchar(100) NOT NULL,
  `service_id` int(11) NOT NULL,
  `Number` int(11) NOT NULL,
  `status` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
)";
       $query_run=mysql_query($query3);   


$query4="Create table service
 (
  `service_id` int(11) NOT NULL AUTO_INCREMENT,
  `service_offer` varchar(100) NOT NULL,
  `price` decimal(11,2) NOT NULL,
  PRIMARY KEY (`service_id`)
)";
      $query_run=mysql_query($query4);   
$query5="Create table users
  (
  `user_id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL,
  PRIMARY KEY (`user_id`)
)";
  $query_run=mysql_query($query5);   
?>
<?php include('header.php'); ?>
<!-- -->
      <div class="navbar navbar-fixed-top navbar-inverse">
            <div class="navbar-inner">
                <div class="container">
                    <a class="btn btn-navbar" data-toggle="collapse"  
    data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a>
                    <div class="nav-collapse collapse">
                    <ul class="nav">
                    <li class="active" ><a rel="tooltip"  
data-placement="bottom" title="Home" id="home" href="index.php" 
    class=""><i 
    class="icon-home icon-large"></i>&nbsp;Home</a></li>
                    <li><a rel="tooltip"  data-placement="bottom" 
    title="Services" id="services" href="services.php" class=""><i 
    class="icon-list icon-large"></i>&nbsp;Services</a></li>
                    <li><a rel="tooltip"  data-placement="bottom" 
    title="About Us" id="aboutus" href="about.php" class=""><i 
    class="icon-info 
    icon-large"></i>&nbsp;About Us</a></li>
                    <li><a rel="tooltip"  data-placement="bottom" 
   title="Contact Us" id="contactus" href="contact_us.php" class=""><i   
    class="icon-phone icon-large"></i>&nbsp;Contact US</a></li>

                    </ul>
                         <form class="navbar-search pull-right">
                         <input type="text" class="search-query"        
    placeholder="Search">
                         </form>

                    </div>
                </div>
            </div>
        </div>

<!-- -->
<?php include('dbcon.php'); ?>
<div class="container">
    <div class="margin-top">
        <div class="row">
            <div class="span12">
            <?php include('banner.php'); ?>
            </div>
            <div class="span12">
            <div class="caption_index">we provide                       
the                          quality         dental service</div>
            </div>      
            <div class="clearfix"></div>
            <div class="span12">
                <?php include('thumbnail.php'); ?>
            </div>
            <div class="span12">
            <?php include('content1.php'); ?>
            </div>
            <div class="span12">
            <?php include('content2.php'); ?>   
            </div>
        </div>
    </div>
</div>
<?php include('footer.php') ?>`*

这是检查数据库是否存在的示例代码,请注意我使用 mysqli 而不是 mysql 因为 this reason.

<?php
$server = "localhost";
$user = "root";
$pwd = "";
$db = "GlobalStyling";
$conn = mysqli_connect($server, $user, $pwd);
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}

$dbExists = mysqli_select_db($conn, $db);
// Checking if Database not Exists
if(!$dbExists) {
    // Create Database
    $sql = "CREATE DATABASE $db";
    $result = mysqli_query($conn, $sql) or die(mysqli_error($conn));

    // Create Table
    mysqli_select_db($conn, $db);
    $query1 = "Create table members
      (
      `member_id` int(11) NOT NULL AUTO_INCREMENT,
      `firstname` varchar(100) NOT NULL,
      `lastname` varchar(100) NOT NULL,
      `middlename` varchar(100) NOT NULL,
      `address` varchar(100) NOT NULL,
      `email` varchar(100) NOT NULL,
      `contact_no` varchar(100) NOT NULL,
      `age` int(11) NOT NULL,
      `gender` varchar(100) NOT NULL,
      `username` varchar(100) NOT NULL,
      `password` varchar(100) NOT NULL,
      PRIMARY KEY (`member_id`)
      )";
    $query_run = mysqli_query($conn, $query1);

    $query2 = "Create table note
      (
      `note_id` int(11) NOT NULL AUTO_INCREMENT,
      `date` varchar(100) NOT NULL,
      `message` varchar(200) NOT NULL,
      PRIMARY KEY (`note_id`)
      )";
    $query_run = mysqli_query($conn, $query2);

    $query3 = "Create table schedule
      (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `member_id` int(11) NOT NULL,
      `date` varchar(100) NOT NULL,
      `service_id` int(11) NOT NULL,
      `Number` int(11) NOT NULL,
      `status` varchar(100) NOT NULL,
      PRIMARY KEY (`id`)
      )";
    $query_run = mysqli_query($conn, $query3);

    $query4 = "Create table service
      (
      `service_id` int(11) NOT NULL AUTO_INCREMENT,
      `service_offer` varchar(100) NOT NULL,
      `price` decimal(11,2) NOT NULL,
      PRIMARY KEY (`service_id`)
      )";
    $query_run = mysqli_query($conn, $query4);

    $query5 = "Create table users
      (
      `user_id` int(11) NOT NULL AUTO_INCREMENT,
      `username` varchar(100) NOT NULL,
      `password` varchar(100) NOT NULL,
      PRIMARY KEY (`user_id`)
      )";
    $query_run = mysqli_query($conn, $query5);
}
mysqli_close($conn);
?>

示例代码不是您见过的最漂亮的代码。