Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 创建特定于用户的表?_Php_Html_Mysql_Database - Fatal编程技术网

Php 创建特定于用户的表?

Php 创建特定于用户的表?,php,html,mysql,database,Php,Html,Mysql,Database,我有一个注册和登录PHP脚本,它使用会话,并在登录时显示每个用户名。我还有一个表单,他们可以填写,并将其添加到mysql数据库中。是否有可能只有填写表单的用户才能在表单显示时看到它?当前,每当任何用户填写表单时,它都会显示给每个用户 <?PHP require_once("./include/membersite_config.php"); if(!$fgmembersite->CheckLogin()) { $fgmembersite->RedirectToURL(

我有一个注册和登录PHP脚本,它使用会话,并在登录时显示每个用户名。我还有一个表单,他们可以填写,并将其添加到mysql数据库中。是否有可能只有填写表单的用户才能在表单显示时看到它?当前,每当任何用户填写表单时,它都会显示给每个用户

<?PHP
require_once("./include/membersite_config.php");

if(!$fgmembersite->CheckLogin())
{
    $fgmembersite->RedirectToURL("login.php");
    exit;

}


?>
<!DOCTYPE>
<html>
<head>
      <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
      <title></title>
      <link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css">
</head>
<body>
<div id='fg_membersite_content'>
<h2>Product control page</h2>
<p>
Logged in as: <?= $fgmembersite->UserFullName() ?>
</p>
<p>Here you can see your Current Products:</p>

<?php
$con = mysql_connect("localhost","root","password");
if (!$con){
die("Can not connect: " . mysql_error());
}
mysql_select_db("trackerweb",$con);
$result = mysql_query("SELECT Name_of_Product FROM Product_Tracker");
while ($row = mysql_fetch_assoc($result)) {
  echo $row['Name_of_Product'];
  echo "<br />";

mysql_query($query); 

}
mysql_close($con);

?>

<p>
<a href='add_customer.php'>Add a new product </a>
</p>
<p>
<a href='view.php'>View all product details</a>
</p>
<p>
<a href='login-home.php'>Home</a>
</p>
</div>
</body>
</html>
当他们在同一页上填写表单时,我只需要显示产品的名称

表格如下:

<?php 
require_once("/extlib/vdaemon/vdaemon.php");

require_once("./core/config.php");

$_SESSION['user']= ['$fgmembersite->UserFullName'];
 ?>
<html>
<head>
<style type="text/css">
body {
    background: #e4e4e4;
}

.form {
    width: 600px;
    margin: 0 auto;
    background: #fff;
    padding: 45px;
    border: 1px solid #c2c2c2;
}

.error {
    color: #AA0000
}
.controlerror {
    background-color: #ffffdd;
    border: 1px solid #AA0000;
}

.input {
    width: 300px;
    height: 35px;
    margin-left: 10px;
}
</style>
</head>
<body>
<div class="form">
<?php
$msg = $_GET['msg'];

if ( $msg == '1' ) {
    echo '<p>Your information was submitted successfully.</p>';
}
?>

<form action="core/process.php" method="post" id="registration" >
<input type="hidden" name="formID" value="Product_Tracker" />

<p>Name of product:<input type="text" name="Name of Product" class="input" />


<p>Please select the tests that were done on the product.</p>   
<p>In Circuit Test (ICT): Yes: <input type="radio" name="ICT" value="yes" /> No: <input type="radio" name="ICT" value="no" /></p>
<p>Visual Inspection: Yes: <input type="radio" name="Visual Inspection" value="yes" /> No: <input type="radio" name="Visual Inspection" value="no" /></p>
<p>XRAY: Yes: <input type="radio" name="XRAY" value="yes" /> No: <input type="radio" name="XRAY" value="no" /></p>
<p>Automated Optical Inspection (AOI): Yes: <input type="radio" name="AOI" value="yes" /> No: <input type="radio" name="AOI" value="no" /></p>
<!--<p>Checkbox1 <input type="checkbox" name="checkbox" value="checkbox1" /> Checkbox2: <input type="checkbox" name="checkbox" value="checkbox2" /></p>-->



<input type="submit" value="Submit" />
<p>
<a href='access-controlled.php'>Back</a>
</p>
</form>
</div>
</body>
</html>
<?php VDEnd(); ?>

你能说得更具体些吗?不清楚。你说你有一张他们可以填写的表格,但他们填写的是什么?我更新了表格,只需要在他们的个人资料页面中显示他们唯一输入的产品名称。逻辑是,当他们点击“提交”时,你将输入的数据与他们唯一的用户id一起保存在一个单独的表中。因此,在个人资料页面中,在WHERE子句中使用select查询,比如user\u id=$\u SESSION['id'],检索他们输入的所有内容并显示它。所以,它将只显示用户输入的内容。好的,这是有意义的,但是我该如何做呢?我该如何创建一个包含用户唯一id的单独表?现在,我有一个表,其中包含用户注册时的信息-id_用户/姓名/密码电子邮件电话号码等。然后,我在同一数据库中有一个不同的表,其中包含他们填写的表单。