简体   繁体   English

php - 将 MySQL 表列插入 PHP 文档

[英]php - Inserting a MySQL table column into a PHP document

I'm new to PHP and have been working on a variation of a system I am using.我是 PHP 新手,一直在研究我正在使用的系统的变体。 This system is comprised of PHP, HTML and CSS (duh).该系统由 PHP、HTML 和 CSS 组成(废话)。 It's a user registration and management system.它是一个用户注册和管理系统。

At current, if I want to insert the current user's email address, all I have to do is insert <?= $fgmembersite->UserEmail(); ?>目前,如果我想插入当前用户的电子邮件地址,我所要做的就是插入<?= $fgmembersite->UserEmail(); ?> <?= $fgmembersite->UserEmail(); ?> and it will display the current user's email address. <?= $fgmembersite->UserEmail(); ?>它将显示当前用户的电子邮件地址。

I've added a custom field to my database table, and want to be able to reference it on the page, like the above code does.我已经在我的数据库表中添加了一个自定义字段,并希望能够在页面上引用它,就像上面的代码一样。

Here is a screenshot of my MySQL table:这是我的 MySQL 表的屏幕截图: 在此处输入图片说明

And here is a pastebin of my PHP: Pastebin这是我的 PHP 的pastebinPastebin

I apologize if i'm not making much sense, I am new to PHP and are really trying my hardest to make this question as easy as possible for any possible helpers.如果我没有多大意义,我深表歉意,我是 PHP 的新手,并且正在尽我最大的努力让任何可能的帮助者尽可能轻松地解决这个问题。 Thankyou in advance.先感谢您。

After looking through your code I found your mistake.在查看您的代码后,我发现了您的错误。 The mistake is in错误在于

function CheckLoginInDB($username,$password)

In $qry you selected columns name and email but not domain.$qry您选择了列名称和电子邮件,但未选择域。

You should replace $qry with the following:您应该将$qry替换$qry以下内容:

$qry = "SELECT name, email, domain FROM $this->tablename WHERE username='$username' AND password='$pwdmd5' AND confirmcode='y'";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM