如何在注册过程中为用户创建特定的URL? [英] How to create a specific URL for a user during registration?

查看:74
本文介绍了如何在注册过程中为用户创建特定的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在MySQL中做到这一点?

How can I do this in MySQL?

当用户在网站上创建帐户时,我希望为其创建个人资料URL.例如:http://www.domain.com/profile.php?id=111101,下一个用户的URL可能是:http://www.domain.com/profile.php?id=111102我是否需要设置自动增量? 我在用户注册期间确实保存的一些字段是:

When a user creates an account on a website, I want a profile URL to be created for him/her. For example: http://www.domain.com/profile.php?id=111101, the next user's URL may be: http://www.domain.com/profile.php?id=111102 Will I have to set Auto Increment? Some of the fields I do save during the user's registration are:

$sql="INSERT INTO Members (fldFullName, fldEmail, Password, Gender, DOB)
VALUES
('$fname','$email','$pass', '$gender', '$date')";

到目前为止,URL的字段为:ProfileURL
谢谢.

As of now, the field for URL is: ProfileURL
Thank you.

推荐答案

您可以创建一个ID列,该列将自动递增.但是,如果您将其传递给您 您必须非常谨慎地对待如何填充所说用户的查询的URL 个人资料(例如避免这种情况)

You can create an ID column that will auto increment. However if you pass that to your URL you will have to be very careful with how you handle the query of populating said users profile (e.g. avoid this)

SELECT * FROM Members WHERE ID = '.$id.';

所以你可以做 $ sql ="INSERT INTO成员(ID,fldFullName,fldEmail,密码,性别,DOB) 价值 ('','$ fname','$ email','$ pass','$ gender','$ date')"

So you can do $sql="INSERT INTO Members (ID,fldFullName, fldEmail, Password, Gender, DOB) VALUES ('','$fname','$email','$pass', '$gender', '$date')"

请注意用户输入

这篇关于如何在注册过程中为用户创建特定的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆