Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.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_Database - Fatal编程技术网

在Php中为不同的用户创建唯一的表

在Php中为不同的用户创建唯一的表,php,html,database,Php,Html,Database,我有一个php页面,它有一个与之关联的数据库。对于访问我的页面的不同用户,我希望生成一个唯一的表来输入他们的详细信息。我希望以某种方式从url生成此名称,以便如果同一用户再次登录,我可以使用之前为他创建的相同表。我是php新手,不知道怎么做 <html> <head> <title>PHP Script</title> </head> <body> <?php

我有一个php页面,它有一个与之关联的数据库。对于访问我的页面的不同用户,我希望生成一个唯一的表来输入他们的详细信息。我希望以某种方式从url生成此名称,以便如果同一用户再次登录,我可以使用之前为他创建的相同表。我是php新手,不知道怎么做

<html>
   <head>
      <title>PHP Script</title>
   </head>
   <body>
      <?php
         echo "<h1>Hello, User!</h1>";
         /* i want to get a unique name for creating a table
         in the database corresponding to the user who logged in
         so that i can enter all details collected from the user
         to a unique table */
      ?>
   </body>
</html>

PHP脚本

你的问题有很多答案。最好的方法是使用php框架。 另一个简单的方法是像这样使用
GET

URL:
http://example.com/?user=sky

在PHP中:

<?php
   $username = $_GET['user'];
   //Now you got the username. You can load user info with this

为每个用户创建一个表是创建一个完全无法维护的模式的方式,它会破坏连接到服务器的任何SQL管理工具。我强烈建议不要这样做。正如@tadman所指出的,这是一个坏主意,所以问题通常要求你尽最大努力实现你的想法,然后,如果某个问题不起作用或不符合预期,则会提出一个问题。@MarcL。对于问题的质量差,我很抱歉。路由通常比超级难看的URL(如
/?user=XXX
)要好得多。Laravel在保持URL干净方面做得很好。很好的推荐。