为什么在我的数据库中显示“& email”而不是实际的电子邮件地址? [英] Why is it showing '&email' in my database instead of the actual email address?
问题描述
大家好
任何人都可以帮助我。
我正在建立一个PHP网站,在phpMyAdmin上创建了我的数据库。我创建了一个名为maxipakdb的数据库,并使用一个名为maxipak table的表。
当我输入数据时,例如,我正在创建的网页上的电子邮件,它显示在phpMyAdmin上,但不是显示我输入的实际电子邮件,而是显示在我的数据库中,它显示为& email。谁能告诉我为什么?
请参阅下面的代码。一切都在100%工作,直到我想看看我的数据库上订阅了哪些电子邮件。
Hi all
Could anyone please help me.
I am building a PHP website and created my database on phpMyAdmin. I created a database called maxipakdb and withing that a table called maxipak table.
When I type in data, for example, my email on the webpage I am creating, it displays on phpMyAdmin, but instead of showing the actual email I typed in, on my database, it shows as &email. Can anyone tell me why?
Please see my code below. Everything is working 100% until I want to see what emails have subscribed on my database.
<?php
/* Database config */
$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_database = 'maxipakdb';
/* End config */
$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_database);
/* check connection */
if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}
$email = $_POST['email'];
// Perform queries
mysqli_query($mysqli, "INSERT INTO maxipaktable (id,email) VALUES (NULL,'&email')");
header('Location: success.php');
echo $email;
?>
我有什么尝试过:
我没有尝试太多因为我被卡住了。我试图谷歌可能的解决方案,但我不知道如何为谷歌说它。我还是编程新手。
What I have tried:
I haven't tried much really because I am stuck. I have tried to google possible solutions but I am not to sure how to word it for google. I am still new to programming.
推荐答案
db_host = ' 本地主机'跨度>;
db_host = 'localhost';
db_user = ' 根跨度>;
db_user = 'root';
db_pass = ' '跨度>;
db_pass = '';
这篇关于为什么在我的数据库中显示“& email”而不是实际的电子邮件地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!