繁体   English   中英

如何在此处添加 SQL 列值

[英]How to add SQL column value here

如何更改提交“updated_by”的“人名”mysql 列?

<?php
$updated_by=$_GET['updated_by'];
$sql = "SELECT * from neonat_patient where updated_by='Name of the Person';";
$query = $dbh -> prepare($sql);
$query-> bindParam(':updated_by', $updated_by, PDO::PARAM_STR);   
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $result)
{               
?>

只是将“人名”替换为几处更改? 以及绑定参数的一些变化

<?php
$updated_by=$_GET['updated_by'];
$sql = "SELECT * from neonat_patient where updated_by=?";
$query = $dbh -> prepare($sql);
$query-> bindParam(1, $updated_by, PDO::PARAM_STR);   
$query->execute();
$results=$query->fetchAll(PDO::FETCH_ASSOC);
$cnt=1;
if($query->rowCount() > 0)
{
foreach($results as $result)
{               
?>

暂无
暂无

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

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