如何使用PHP更新SQL数据库表? [英] How can I update a SQL database table using PHP?

查看:89
本文介绍了如何使用PHP更新SQL数据库表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我需要这方面的帮助,我是PHP的新手我已经想了一个多星期了,我还没找到答案。



我想向电子书的订阅者发送电子邮件。我想在电子邮件中包含一个链接,所以当点击链接时,订阅者数据库将被更新。



点击此链接后,订阅者将被重定向到我的主页。



所以我从头到尾都遇到了麻烦。



这是我到目前为止编写的代码:



Hello, please I need help with this, i''m new to PHP I''ve been trying to figure out for over a week, an I''ve still found no answers.

I want to send out emails to the subscribers of my eBook. I want to include a link in the email, so when the link is clicked, the subscribers database will be updated.

When this link is clicked, the subscribers are redirected to my homepage.

So i''m having trouble with everything, from start to finish.

This is the code I''ve written so far:

<body>

<a href="" target="_blank">Click Here To Say YES!</a>

<?php

mysql_connect("localhost", "root", "");
mysql_select_db("rmn");

$sql = mysql_query("UPDATE subscribe SET confirmaton ='YES' WHERE email= [email]");




?>
</body> 







非常感谢!




Thank you very much!

推荐答案

sql = mysql_query(UPDATE subscribe SET confirmaton ='YES'WHERERE email = [email]);




?>
< / body>
sql = mysql_query("UPDATE subscribe SET confirmaton ='YES' WHERE email= [email]"); ?> </body>







非常感谢!




Thank you very much!


检查这是否作品:




Check if this works :



con = mysqli_connect(wwwwwwwwwww.com,any_name,passw ,my_db);



//检查连接



if(mysqli_connect_errno())

{

echo无法连接到MySQL:。 mysqli_connect_error();

}
con=mysqli_connect("wwwwwwwwwww.com","any_name","passw","my_db");

// Check connection

if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}


这篇关于如何使用PHP更新SQL数据库表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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