重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
修改如下:不用使用session传递
创新互联-专业网站定制、快速模板网站建设、高性价比九原网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式九原网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖九原地区。费用合理售后完善,十载实体公司更值得信赖。
1.php 文件中: 修改后的代码,将$row["id"]作为id的参数值传递到2.php
else{
echo 'td'.'a href="2.php?id='.$row["id"].'"'.$row["id"].可以修改.'/a/td';
}
2.php修改如下:
$strSql="SELECT * from test where id=".$_GET['id'];
?php
mysql_connect('127.0.0.1','root','123456');
$sql="update sjk._sjk set b='1',c='1' where a='123'";
if (mysql_query($sql)) echo '修改成功。';
else echo "修改失败,SQL:$sqlbr错误:".mysql_error();
mysql_close();
?
用数据库函数直接实现:
1.将所有product_name修改为首字母大写,其余全小写
update
product_details
set
product_name=concat(upper(left(product_name,1)),lower(mid(login_name,2,length(product_name)-1)))
;
2.将所有product_name修改为首字母大写,其余保持不变
update
product_details
set
product_name=concat(upper(left(product_name,1)),mid(login_name,2,length(product_name)-1))
;
?php
$con = mysql_connect("localhost:3306","root","");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
$result = mysql_query("SELECT * FROM user");
echo "table border='1'
tr
thUsername/th
thPassword/th
/tr";
while($row = mysql_fetch_array($result)) {
echo "tr";
echo "td" . $row['username'] . "/td";
echo "td" . $row['password'] . "/td";
echo "/tr";
}
echo "/table";
mysql_close($con);
?
从服务器中获取用户所有信息(SQL SELECT语句)并以表格形式出现
?php
$con = mysql_connect("localhost","root","");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
mysql_query("DELETE FROM user WHERE username = '$_POST[username]'");
mysql_close($con);
?
删除该用户所有信息delete.php
?php
$con = mysql_connect("localhost:3306","root","");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
$sql = "INSERT INTO user (username,password)
VALUES
('$_POST[username]','$_POST[password]')";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
?
注册一个新用户insert.php
?php
$con = mysql_connect("localhost","root","");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
mysql_query("UPDATE user SET password = '$_POST[password]' WHERE username = '$_POST[username]'");
mysql_close($con);
?
修改一个用户密码update.php
html
head
titleFORM/title
/head
body
br /
h1Insert:/h1
form action="insert.php" method="post"
username:input type="name" name="username"/
br /
password:input type="password" name="password"/
input type="submit" value="submit"/
/form
br /hr /br /
h1Delete/h1
form action="delete.php" method="post"
username:input type="name" name="username" /
br /
Are you sure?input type="submit" value="sure" /
/form
br /hr /br /
h1Update/h1
form action="update.php" method="post"
username:input type="name" name="username"/
br /
You want to change your password into:input type="password" name="password"/
input type="submit" value="submit"/
/form
br /hr /br /
/body
/html
以上三个功能的提交源Operate.html
需要修改下面三项改成新数据库的资料
/** WordPress数据库的名称 */
define('DB_NAME', 'aaaaaa');
/** MySQL数据库用户名 */
define('DB_USER', 'bbbbbb');
/** MySQL数据库密码 */
define('DB_PASSWORD', '123123');
$sql="update wp_prli_links set url='?' where id = $id ";这样不行就换种方式嘛,$url="?";
$sql="update wp_prli_links set url='".$url."' where id = $id ";