如何使用PHP更新mysql行并显示更新的行 [英] How to update a mysql row and display the updated row using PHP

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

问题描述

我需要更新行并显示更新的行。



在我的下面的代码更新查询正在运行。但是无法显示。



我的尝试:



< ?php

include_once'db.php'





if(isset($ _ GET ['PID' ])){





$ id = $ _ GET ['PID'];







$ sql =UPDATE assign t2,

(SELECT PID,pname,pemail,ph_no,experience

来自addpandit

)t1

SET t2.PID = t1.PID,t2.pname = t1.pname,t2.pemail = t1.pemail ,t2.ph_no = t1.ph_no,t2.experience = t1.experience

WHERE t2.PID =''AND t1.PID = $ id;

$ insert_user = $ conn->查询($ sql);





$ sql1 =SELECT * FROM assign WHERE PID = $ id ;

$ result = $ connect->查询($ sql1);

$ rows = $ result-> fetch_assoc();

echo($ rows ['AID']);



}

?>

I need to update row and display the updated row.

In my below code update query is working. But cannot display.

What I have tried:

<?php
include_once 'db.php'


if(isset($_GET['PID'])){


$id=$_GET['PID'];



$sql = "UPDATE assign t2,
( SELECT PID,pname,pemail,ph_no,experience
FROM addpandit
) t1
SET t2.PID = t1.PID,t2.pname = t1.pname,t2.pemail = t1.pemail,t2.ph_no = t1.ph_no,t2.experience = t1.experience
WHERE t2.PID='' AND t1.PID=$id";
$insert_user=$conn->query($sql);


$sql1="SELECT * FROM assign WHERE PID=$id";
$result=$connect->query($sql1);
$rows=$result->fetch_assoc();
echo ($rows['AID']);

}
?>

推荐答案

_GET ['PID'])){




_GET['PID'])){



id =


_GET ['PID'];






_GET['PID'];




这篇关于如何使用PHP更新mysql行并显示更新的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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