PHP updating MS SQL database
Obviously, I need a second pair of eyes to review this as I can't seem to find the error(s)...
The data pulls back correctly into the form as it should. However, when I change the data, such as adding extra m's on the end of the email address, I get the message "Settings Updated Successfully". But checking the database the database shows nothing updated.
<?php
session_start();
include ("../../includes.php");
include ("../../configs/configDashboard.php");
$Squery="Select IDX, AgencyID, username, password, email,
FBSAgencyID, MBSAgencyID, CETAgencyID,
jurisdiction, pageafterlogin,
CASE when FBS=1 then 'True' ELSE 'False' End as FBS,
CASE when MBS=1 then 'True' ELSE 'False' End as MBS,
CASE when CET=1 then 'True' ELSE 'False' End as CET,
CASE when adminuser=1 then 'True' ELSE 'False' End as adminuser,
CASE when InventorySearch=1 then 'True' ELSE 'False' End as InventorySearch,
CASE when Inactive=1 then 'True' ELSE 'False' End as Inactive
from tblUsers where IDX = '14'";
$Sresult = sqlsrv_query($Sconn, $Squery) ;
$row = sqlsrv_fetch_array($Sresult,SQLSRV_FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Inventory Dashboard</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- Bootstrap 3.3.2 -->
<link href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- Font Awesome Icons -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="http://code.ionicframework.com/ionicons/2.0.0/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="../../dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link href="../../dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="http://www.chartphp.com/wp-content/uploads/favicon.png">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="../../lib/js/jquery.min.js"></script>
<script src="../../lib/js/chartphp.js"></script>
<script src="../../lib/js/chartphp-l.js"></script>
<link rel="stylesheet" href="/lib/js/chartphp.css">
<style>
/* white color data labels */
.jqplot-data-label{color:white;}
.jqplot-table-legend td {
font-size: 115%;
padding-bottom: 0;
padding-left: 2px;
padding-right: 2px;
}
/* white color data labels */
.jqplot-point-label{color:white;}
</style>
</head>
<body class="skin-black">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="http://www.southernsoftware.com" class="logo"><img src="../../SmallLogo-Horizontal.png" height="35" width="auto"></a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<img src="../../Badge.jpg" height="42" width="42" align="left"><h3><strong><?php echo $AgencyName?></strong></h3>
<!-- Navbar Right Menu -->
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- sidebar menu: : style can be found in sidebar.less -->
<?php include ("../../sidebarmenu.php")?>
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class='col-md-12'>
<div class="box box-success">
<div class="box-header with-border" id="groupbarrests">
<h3 class="box-title">Dashboard Settings</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div><!-- /.box-header -->
<div class="box-body no padding">
<div class="row">
<div class="col-md-12">
<div class="pad">
<?php
//$status = "";
if(isset($_POST['new']) && $_POST['new']==1)
{
$username =$_POST['username'];
$password =$_POST['password'];
$email =$_POST['email'];
$AgencyID =$_POST['AgencyID'];
$FBSAgencyID =$_POST['FBSAgencyID'];
$MBSAgencyID =$_POST['MBSAgencyID'];
$CETAgencyID =$_POST['CETAgencyID'];
$jurisdiction =$_POST['jurisdiction'];
$FBS =$_POST['FBS'];
$MBS =$_POST['MBS'];
$CET =$_POST['CET'];
$pageafterlogin =$_POST['pageafterlogin'];
$adminuser =$_POST['adminuser'];
$InventorySearch =$_POST['InventorySearch'];
$Inactive =$_POST['Inactive'];
//$FBSIndexIncTypeExcludeOther =$_POST['FBSIndexIncTypeExcludeOther'];
//$FBSIndexIncTypeExcludeOther= isset($my_array['FBSIndexIncTypeExcludeOther']) ? $my_array['FBSIndexIncTypeExcludeOther'] : "";
$update="update tblUsers set username='".$username."', password='".base64_encode($password)."',email='".$email."'
, jurisdiction='".$jurisdiction."', FBS='".$FBS."', MBS='".$MBS."'
, CET='".$CET."', pageafterlogin='".$pageafterlogin."', adminuser='".$adminuser."'
, InventorySearch='".$InventorySearch."', Inactive='".$Inactive."'
Where IDX = '14'
";
sqlsrv_query($Sconn, $update) ;
$arr = sqlsrv_errors();
foreach ($arr as $value) { echo $value; };
$status = "Settings Updated Successfully. </br></br>";
echo $status;
//header ("Location: settings.php");
}else {
?>
<div>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1" />
<table border='4' column width='500' >
<tr>
<tr><td bgcolor="#33ccff"><center>User Settings</center></td></tr>
<td>
Username <input type="text" name="username" placeholder="Username"
required value="<?php echo $row['username'];?>"</><br><br>
Password <input type="text" name="password" placeholder="Password"
required value="<?php echo base64_decode($row['password']);?>"</><br><br>
Email <input type="text" name="email" placeholder="Email"
required value="<?php echo $row['email'];?>"</><br><br>
FBS <select name="FBS">
<option value="True">True</option>
<option value="False">False</option>
<option selected="selected"><?php echo $row['FBS'];?></option>
</select><br><br>
MBS <select name="MBS">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['MBS'];?></option>
</select><br><br>
CET <select name="CET">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['CET'];?></option>
</select><br><br>
Jurisdictions <input type="text" name="jurisdictions" placeholder="Jurisdictions"
value="<?php echo $row['jurisdiction'];?>"</><br><br>
Landing Page <select name="pageafterlogin">
<option value="../CET/dayreport.php">CET Day Report</option>
<option value="../FBS/dayreport.php">FBS Day Report</option>
<option value="../MBS/dayreport.php">MBS Day Report</option>
<option selected="selected"><?php echo $row['pageafterlogin'];?></option>
</select><br><br>
Is Admin <select name="adminuser">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['adminuser'];?></option>
</select><br><br>
Access Master Name Search <select name="InventorySearch">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['InventorySearch'];?></option>
</select><br><br>
Inactive <select name="Inactive">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['Inactive'];?></option>
</select><br><br>
</table>
<p><input name="submit" type="submit" value="Update" /></p>
</form>
<?php } ?>
</div>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
<!--End Main Content-->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b> Analytics Version</b> <?php echo $version ?> |
<a href="../../CET/appversions.php" >SS App versions</a>
</div>
<strong>Copyright © 2018 <a href="http://www.MEBallway.com">MED Allway, Inc</a>,</strong> All rights reserved.
</footer>
</div><!-- ./wrapper -->
<!-- Bootstrap 3.3.2 JS -->
<script src="../../bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<!-- FastClick -->
<script src='../../plugins/fastclick/fastclick.min.js'></script>
<!-- AdminLTE App -->
<script src="../../dist/js/app.min.js" type="text/javascript"></script>
</body>
</html>
I've included some error output code to see if anything comes up but I'm getting nothing with that.
Any help would be appreciated.
Edit: Edited to fix some typos found. Still not working as expected
php sql-server forms
|
show 1 more comment
Obviously, I need a second pair of eyes to review this as I can't seem to find the error(s)...
The data pulls back correctly into the form as it should. However, when I change the data, such as adding extra m's on the end of the email address, I get the message "Settings Updated Successfully". But checking the database the database shows nothing updated.
<?php
session_start();
include ("../../includes.php");
include ("../../configs/configDashboard.php");
$Squery="Select IDX, AgencyID, username, password, email,
FBSAgencyID, MBSAgencyID, CETAgencyID,
jurisdiction, pageafterlogin,
CASE when FBS=1 then 'True' ELSE 'False' End as FBS,
CASE when MBS=1 then 'True' ELSE 'False' End as MBS,
CASE when CET=1 then 'True' ELSE 'False' End as CET,
CASE when adminuser=1 then 'True' ELSE 'False' End as adminuser,
CASE when InventorySearch=1 then 'True' ELSE 'False' End as InventorySearch,
CASE when Inactive=1 then 'True' ELSE 'False' End as Inactive
from tblUsers where IDX = '14'";
$Sresult = sqlsrv_query($Sconn, $Squery) ;
$row = sqlsrv_fetch_array($Sresult,SQLSRV_FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Inventory Dashboard</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- Bootstrap 3.3.2 -->
<link href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- Font Awesome Icons -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="http://code.ionicframework.com/ionicons/2.0.0/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="../../dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link href="../../dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="http://www.chartphp.com/wp-content/uploads/favicon.png">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="../../lib/js/jquery.min.js"></script>
<script src="../../lib/js/chartphp.js"></script>
<script src="../../lib/js/chartphp-l.js"></script>
<link rel="stylesheet" href="/lib/js/chartphp.css">
<style>
/* white color data labels */
.jqplot-data-label{color:white;}
.jqplot-table-legend td {
font-size: 115%;
padding-bottom: 0;
padding-left: 2px;
padding-right: 2px;
}
/* white color data labels */
.jqplot-point-label{color:white;}
</style>
</head>
<body class="skin-black">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="http://www.southernsoftware.com" class="logo"><img src="../../SmallLogo-Horizontal.png" height="35" width="auto"></a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<img src="../../Badge.jpg" height="42" width="42" align="left"><h3><strong><?php echo $AgencyName?></strong></h3>
<!-- Navbar Right Menu -->
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- sidebar menu: : style can be found in sidebar.less -->
<?php include ("../../sidebarmenu.php")?>
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class='col-md-12'>
<div class="box box-success">
<div class="box-header with-border" id="groupbarrests">
<h3 class="box-title">Dashboard Settings</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div><!-- /.box-header -->
<div class="box-body no padding">
<div class="row">
<div class="col-md-12">
<div class="pad">
<?php
//$status = "";
if(isset($_POST['new']) && $_POST['new']==1)
{
$username =$_POST['username'];
$password =$_POST['password'];
$email =$_POST['email'];
$AgencyID =$_POST['AgencyID'];
$FBSAgencyID =$_POST['FBSAgencyID'];
$MBSAgencyID =$_POST['MBSAgencyID'];
$CETAgencyID =$_POST['CETAgencyID'];
$jurisdiction =$_POST['jurisdiction'];
$FBS =$_POST['FBS'];
$MBS =$_POST['MBS'];
$CET =$_POST['CET'];
$pageafterlogin =$_POST['pageafterlogin'];
$adminuser =$_POST['adminuser'];
$InventorySearch =$_POST['InventorySearch'];
$Inactive =$_POST['Inactive'];
//$FBSIndexIncTypeExcludeOther =$_POST['FBSIndexIncTypeExcludeOther'];
//$FBSIndexIncTypeExcludeOther= isset($my_array['FBSIndexIncTypeExcludeOther']) ? $my_array['FBSIndexIncTypeExcludeOther'] : "";
$update="update tblUsers set username='".$username."', password='".base64_encode($password)."',email='".$email."'
, jurisdiction='".$jurisdiction."', FBS='".$FBS."', MBS='".$MBS."'
, CET='".$CET."', pageafterlogin='".$pageafterlogin."', adminuser='".$adminuser."'
, InventorySearch='".$InventorySearch."', Inactive='".$Inactive."'
Where IDX = '14'
";
sqlsrv_query($Sconn, $update) ;
$arr = sqlsrv_errors();
foreach ($arr as $value) { echo $value; };
$status = "Settings Updated Successfully. </br></br>";
echo $status;
//header ("Location: settings.php");
}else {
?>
<div>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1" />
<table border='4' column width='500' >
<tr>
<tr><td bgcolor="#33ccff"><center>User Settings</center></td></tr>
<td>
Username <input type="text" name="username" placeholder="Username"
required value="<?php echo $row['username'];?>"</><br><br>
Password <input type="text" name="password" placeholder="Password"
required value="<?php echo base64_decode($row['password']);?>"</><br><br>
Email <input type="text" name="email" placeholder="Email"
required value="<?php echo $row['email'];?>"</><br><br>
FBS <select name="FBS">
<option value="True">True</option>
<option value="False">False</option>
<option selected="selected"><?php echo $row['FBS'];?></option>
</select><br><br>
MBS <select name="MBS">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['MBS'];?></option>
</select><br><br>
CET <select name="CET">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['CET'];?></option>
</select><br><br>
Jurisdictions <input type="text" name="jurisdictions" placeholder="Jurisdictions"
value="<?php echo $row['jurisdiction'];?>"</><br><br>
Landing Page <select name="pageafterlogin">
<option value="../CET/dayreport.php">CET Day Report</option>
<option value="../FBS/dayreport.php">FBS Day Report</option>
<option value="../MBS/dayreport.php">MBS Day Report</option>
<option selected="selected"><?php echo $row['pageafterlogin'];?></option>
</select><br><br>
Is Admin <select name="adminuser">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['adminuser'];?></option>
</select><br><br>
Access Master Name Search <select name="InventorySearch">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['InventorySearch'];?></option>
</select><br><br>
Inactive <select name="Inactive">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['Inactive'];?></option>
</select><br><br>
</table>
<p><input name="submit" type="submit" value="Update" /></p>
</form>
<?php } ?>
</div>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
<!--End Main Content-->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b> Analytics Version</b> <?php echo $version ?> |
<a href="../../CET/appversions.php" >SS App versions</a>
</div>
<strong>Copyright © 2018 <a href="http://www.MEBallway.com">MED Allway, Inc</a>,</strong> All rights reserved.
</footer>
</div><!-- ./wrapper -->
<!-- Bootstrap 3.3.2 JS -->
<script src="../../bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<!-- FastClick -->
<script src='../../plugins/fastclick/fastclick.min.js'></script>
<!-- AdminLTE App -->
<script src="../../dist/js/app.min.js" type="text/javascript"></script>
</body>
</html>
I've included some error output code to see if anything comes up but I'm getting nothing with that.
Any help would be appreciated.
Edit: Edited to fix some typos found. Still not working as expected
php sql-server forms
Are you missing a space between ‘$Inactive’ and your Where clause in the update query?
– Adam Brinded
Nov 24 '18 at 20:27
Also, add the lines ‘$arr = sqlsrv_errors();’ and ‘foreach ($arr as $value) { echo $value; }’
– Adam Brinded
Nov 24 '18 at 20:32
Never used those before so I wasn't sure where to add it so I added it below sqlsrv_query($Sconn, $update) ;. It outputs "Array" only.
– macnotapplesessor
Nov 24 '18 at 20:48
I misread the documentation on that, (php.net/manual/en/function.sqlsrv-errors.php). You are correct in the placement of it. Remove the foreach loop entirely and instead use ‘var_dump($arr);’. This will show any SQL error that may be there, or NULL if no error
– Adam Brinded
Nov 24 '18 at 23:03
I changed it as you described and came back with 'NULL'. Just FYI I added a raw $update statement with values not deriving for the POST data and that did execute and change the records in SQL. Seems like it's screwed up from the POST values to the $update statement. I may be wrong but that's from testing
– macnotapplesessor
Nov 24 '18 at 23:12
|
show 1 more comment
Obviously, I need a second pair of eyes to review this as I can't seem to find the error(s)...
The data pulls back correctly into the form as it should. However, when I change the data, such as adding extra m's on the end of the email address, I get the message "Settings Updated Successfully". But checking the database the database shows nothing updated.
<?php
session_start();
include ("../../includes.php");
include ("../../configs/configDashboard.php");
$Squery="Select IDX, AgencyID, username, password, email,
FBSAgencyID, MBSAgencyID, CETAgencyID,
jurisdiction, pageafterlogin,
CASE when FBS=1 then 'True' ELSE 'False' End as FBS,
CASE when MBS=1 then 'True' ELSE 'False' End as MBS,
CASE when CET=1 then 'True' ELSE 'False' End as CET,
CASE when adminuser=1 then 'True' ELSE 'False' End as adminuser,
CASE when InventorySearch=1 then 'True' ELSE 'False' End as InventorySearch,
CASE when Inactive=1 then 'True' ELSE 'False' End as Inactive
from tblUsers where IDX = '14'";
$Sresult = sqlsrv_query($Sconn, $Squery) ;
$row = sqlsrv_fetch_array($Sresult,SQLSRV_FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Inventory Dashboard</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- Bootstrap 3.3.2 -->
<link href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- Font Awesome Icons -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="http://code.ionicframework.com/ionicons/2.0.0/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="../../dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link href="../../dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="http://www.chartphp.com/wp-content/uploads/favicon.png">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="../../lib/js/jquery.min.js"></script>
<script src="../../lib/js/chartphp.js"></script>
<script src="../../lib/js/chartphp-l.js"></script>
<link rel="stylesheet" href="/lib/js/chartphp.css">
<style>
/* white color data labels */
.jqplot-data-label{color:white;}
.jqplot-table-legend td {
font-size: 115%;
padding-bottom: 0;
padding-left: 2px;
padding-right: 2px;
}
/* white color data labels */
.jqplot-point-label{color:white;}
</style>
</head>
<body class="skin-black">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="http://www.southernsoftware.com" class="logo"><img src="../../SmallLogo-Horizontal.png" height="35" width="auto"></a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<img src="../../Badge.jpg" height="42" width="42" align="left"><h3><strong><?php echo $AgencyName?></strong></h3>
<!-- Navbar Right Menu -->
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- sidebar menu: : style can be found in sidebar.less -->
<?php include ("../../sidebarmenu.php")?>
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class='col-md-12'>
<div class="box box-success">
<div class="box-header with-border" id="groupbarrests">
<h3 class="box-title">Dashboard Settings</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div><!-- /.box-header -->
<div class="box-body no padding">
<div class="row">
<div class="col-md-12">
<div class="pad">
<?php
//$status = "";
if(isset($_POST['new']) && $_POST['new']==1)
{
$username =$_POST['username'];
$password =$_POST['password'];
$email =$_POST['email'];
$AgencyID =$_POST['AgencyID'];
$FBSAgencyID =$_POST['FBSAgencyID'];
$MBSAgencyID =$_POST['MBSAgencyID'];
$CETAgencyID =$_POST['CETAgencyID'];
$jurisdiction =$_POST['jurisdiction'];
$FBS =$_POST['FBS'];
$MBS =$_POST['MBS'];
$CET =$_POST['CET'];
$pageafterlogin =$_POST['pageafterlogin'];
$adminuser =$_POST['adminuser'];
$InventorySearch =$_POST['InventorySearch'];
$Inactive =$_POST['Inactive'];
//$FBSIndexIncTypeExcludeOther =$_POST['FBSIndexIncTypeExcludeOther'];
//$FBSIndexIncTypeExcludeOther= isset($my_array['FBSIndexIncTypeExcludeOther']) ? $my_array['FBSIndexIncTypeExcludeOther'] : "";
$update="update tblUsers set username='".$username."', password='".base64_encode($password)."',email='".$email."'
, jurisdiction='".$jurisdiction."', FBS='".$FBS."', MBS='".$MBS."'
, CET='".$CET."', pageafterlogin='".$pageafterlogin."', adminuser='".$adminuser."'
, InventorySearch='".$InventorySearch."', Inactive='".$Inactive."'
Where IDX = '14'
";
sqlsrv_query($Sconn, $update) ;
$arr = sqlsrv_errors();
foreach ($arr as $value) { echo $value; };
$status = "Settings Updated Successfully. </br></br>";
echo $status;
//header ("Location: settings.php");
}else {
?>
<div>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1" />
<table border='4' column width='500' >
<tr>
<tr><td bgcolor="#33ccff"><center>User Settings</center></td></tr>
<td>
Username <input type="text" name="username" placeholder="Username"
required value="<?php echo $row['username'];?>"</><br><br>
Password <input type="text" name="password" placeholder="Password"
required value="<?php echo base64_decode($row['password']);?>"</><br><br>
Email <input type="text" name="email" placeholder="Email"
required value="<?php echo $row['email'];?>"</><br><br>
FBS <select name="FBS">
<option value="True">True</option>
<option value="False">False</option>
<option selected="selected"><?php echo $row['FBS'];?></option>
</select><br><br>
MBS <select name="MBS">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['MBS'];?></option>
</select><br><br>
CET <select name="CET">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['CET'];?></option>
</select><br><br>
Jurisdictions <input type="text" name="jurisdictions" placeholder="Jurisdictions"
value="<?php echo $row['jurisdiction'];?>"</><br><br>
Landing Page <select name="pageafterlogin">
<option value="../CET/dayreport.php">CET Day Report</option>
<option value="../FBS/dayreport.php">FBS Day Report</option>
<option value="../MBS/dayreport.php">MBS Day Report</option>
<option selected="selected"><?php echo $row['pageafterlogin'];?></option>
</select><br><br>
Is Admin <select name="adminuser">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['adminuser'];?></option>
</select><br><br>
Access Master Name Search <select name="InventorySearch">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['InventorySearch'];?></option>
</select><br><br>
Inactive <select name="Inactive">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['Inactive'];?></option>
</select><br><br>
</table>
<p><input name="submit" type="submit" value="Update" /></p>
</form>
<?php } ?>
</div>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
<!--End Main Content-->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b> Analytics Version</b> <?php echo $version ?> |
<a href="../../CET/appversions.php" >SS App versions</a>
</div>
<strong>Copyright © 2018 <a href="http://www.MEBallway.com">MED Allway, Inc</a>,</strong> All rights reserved.
</footer>
</div><!-- ./wrapper -->
<!-- Bootstrap 3.3.2 JS -->
<script src="../../bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<!-- FastClick -->
<script src='../../plugins/fastclick/fastclick.min.js'></script>
<!-- AdminLTE App -->
<script src="../../dist/js/app.min.js" type="text/javascript"></script>
</body>
</html>
I've included some error output code to see if anything comes up but I'm getting nothing with that.
Any help would be appreciated.
Edit: Edited to fix some typos found. Still not working as expected
php sql-server forms
Obviously, I need a second pair of eyes to review this as I can't seem to find the error(s)...
The data pulls back correctly into the form as it should. However, when I change the data, such as adding extra m's on the end of the email address, I get the message "Settings Updated Successfully". But checking the database the database shows nothing updated.
<?php
session_start();
include ("../../includes.php");
include ("../../configs/configDashboard.php");
$Squery="Select IDX, AgencyID, username, password, email,
FBSAgencyID, MBSAgencyID, CETAgencyID,
jurisdiction, pageafterlogin,
CASE when FBS=1 then 'True' ELSE 'False' End as FBS,
CASE when MBS=1 then 'True' ELSE 'False' End as MBS,
CASE when CET=1 then 'True' ELSE 'False' End as CET,
CASE when adminuser=1 then 'True' ELSE 'False' End as adminuser,
CASE when InventorySearch=1 then 'True' ELSE 'False' End as InventorySearch,
CASE when Inactive=1 then 'True' ELSE 'False' End as Inactive
from tblUsers where IDX = '14'";
$Sresult = sqlsrv_query($Sconn, $Squery) ;
$row = sqlsrv_fetch_array($Sresult,SQLSRV_FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Inventory Dashboard</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- Bootstrap 3.3.2 -->
<link href="../../bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- Font Awesome Icons -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="http://code.ionicframework.com/ionicons/2.0.0/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="../../dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link href="../../dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="http://www.chartphp.com/wp-content/uploads/favicon.png">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="../../lib/js/jquery.min.js"></script>
<script src="../../lib/js/chartphp.js"></script>
<script src="../../lib/js/chartphp-l.js"></script>
<link rel="stylesheet" href="/lib/js/chartphp.css">
<style>
/* white color data labels */
.jqplot-data-label{color:white;}
.jqplot-table-legend td {
font-size: 115%;
padding-bottom: 0;
padding-left: 2px;
padding-right: 2px;
}
/* white color data labels */
.jqplot-point-label{color:white;}
</style>
</head>
<body class="skin-black">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="http://www.southernsoftware.com" class="logo"><img src="../../SmallLogo-Horizontal.png" height="35" width="auto"></a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<img src="../../Badge.jpg" height="42" width="42" align="left"><h3><strong><?php echo $AgencyName?></strong></h3>
<!-- Navbar Right Menu -->
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- sidebar menu: : style can be found in sidebar.less -->
<?php include ("../../sidebarmenu.php")?>
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class='col-md-12'>
<div class="box box-success">
<div class="box-header with-border" id="groupbarrests">
<h3 class="box-title">Dashboard Settings</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div><!-- /.box-header -->
<div class="box-body no padding">
<div class="row">
<div class="col-md-12">
<div class="pad">
<?php
//$status = "";
if(isset($_POST['new']) && $_POST['new']==1)
{
$username =$_POST['username'];
$password =$_POST['password'];
$email =$_POST['email'];
$AgencyID =$_POST['AgencyID'];
$FBSAgencyID =$_POST['FBSAgencyID'];
$MBSAgencyID =$_POST['MBSAgencyID'];
$CETAgencyID =$_POST['CETAgencyID'];
$jurisdiction =$_POST['jurisdiction'];
$FBS =$_POST['FBS'];
$MBS =$_POST['MBS'];
$CET =$_POST['CET'];
$pageafterlogin =$_POST['pageafterlogin'];
$adminuser =$_POST['adminuser'];
$InventorySearch =$_POST['InventorySearch'];
$Inactive =$_POST['Inactive'];
//$FBSIndexIncTypeExcludeOther =$_POST['FBSIndexIncTypeExcludeOther'];
//$FBSIndexIncTypeExcludeOther= isset($my_array['FBSIndexIncTypeExcludeOther']) ? $my_array['FBSIndexIncTypeExcludeOther'] : "";
$update="update tblUsers set username='".$username."', password='".base64_encode($password)."',email='".$email."'
, jurisdiction='".$jurisdiction."', FBS='".$FBS."', MBS='".$MBS."'
, CET='".$CET."', pageafterlogin='".$pageafterlogin."', adminuser='".$adminuser."'
, InventorySearch='".$InventorySearch."', Inactive='".$Inactive."'
Where IDX = '14'
";
sqlsrv_query($Sconn, $update) ;
$arr = sqlsrv_errors();
foreach ($arr as $value) { echo $value; };
$status = "Settings Updated Successfully. </br></br>";
echo $status;
//header ("Location: settings.php");
}else {
?>
<div>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1" />
<table border='4' column width='500' >
<tr>
<tr><td bgcolor="#33ccff"><center>User Settings</center></td></tr>
<td>
Username <input type="text" name="username" placeholder="Username"
required value="<?php echo $row['username'];?>"</><br><br>
Password <input type="text" name="password" placeholder="Password"
required value="<?php echo base64_decode($row['password']);?>"</><br><br>
Email <input type="text" name="email" placeholder="Email"
required value="<?php echo $row['email'];?>"</><br><br>
FBS <select name="FBS">
<option value="True">True</option>
<option value="False">False</option>
<option selected="selected"><?php echo $row['FBS'];?></option>
</select><br><br>
MBS <select name="MBS">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['MBS'];?></option>
</select><br><br>
CET <select name="CET">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['CET'];?></option>
</select><br><br>
Jurisdictions <input type="text" name="jurisdictions" placeholder="Jurisdictions"
value="<?php echo $row['jurisdiction'];?>"</><br><br>
Landing Page <select name="pageafterlogin">
<option value="../CET/dayreport.php">CET Day Report</option>
<option value="../FBS/dayreport.php">FBS Day Report</option>
<option value="../MBS/dayreport.php">MBS Day Report</option>
<option selected="selected"><?php echo $row['pageafterlogin'];?></option>
</select><br><br>
Is Admin <select name="adminuser">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['adminuser'];?></option>
</select><br><br>
Access Master Name Search <select name="InventorySearch">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['InventorySearch'];?></option>
</select><br><br>
Inactive <select name="Inactive">
<option value="true">True</option>
<option value="false">False</option>
<option selected="selected"><?php echo $row['Inactive'];?></option>
</select><br><br>
</table>
<p><input name="submit" type="submit" value="Update" /></p>
</form>
<?php } ?>
</div>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
<!--End Main Content-->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b> Analytics Version</b> <?php echo $version ?> |
<a href="../../CET/appversions.php" >SS App versions</a>
</div>
<strong>Copyright © 2018 <a href="http://www.MEBallway.com">MED Allway, Inc</a>,</strong> All rights reserved.
</footer>
</div><!-- ./wrapper -->
<!-- Bootstrap 3.3.2 JS -->
<script src="../../bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<!-- FastClick -->
<script src='../../plugins/fastclick/fastclick.min.js'></script>
<!-- AdminLTE App -->
<script src="../../dist/js/app.min.js" type="text/javascript"></script>
</body>
</html>
I've included some error output code to see if anything comes up but I'm getting nothing with that.
Any help would be appreciated.
Edit: Edited to fix some typos found. Still not working as expected
php sql-server forms
php sql-server forms
edited Nov 24 '18 at 22:50
macnotapplesessor
asked Nov 24 '18 at 20:22
macnotapplesessormacnotapplesessor
168
168
Are you missing a space between ‘$Inactive’ and your Where clause in the update query?
– Adam Brinded
Nov 24 '18 at 20:27
Also, add the lines ‘$arr = sqlsrv_errors();’ and ‘foreach ($arr as $value) { echo $value; }’
– Adam Brinded
Nov 24 '18 at 20:32
Never used those before so I wasn't sure where to add it so I added it below sqlsrv_query($Sconn, $update) ;. It outputs "Array" only.
– macnotapplesessor
Nov 24 '18 at 20:48
I misread the documentation on that, (php.net/manual/en/function.sqlsrv-errors.php). You are correct in the placement of it. Remove the foreach loop entirely and instead use ‘var_dump($arr);’. This will show any SQL error that may be there, or NULL if no error
– Adam Brinded
Nov 24 '18 at 23:03
I changed it as you described and came back with 'NULL'. Just FYI I added a raw $update statement with values not deriving for the POST data and that did execute and change the records in SQL. Seems like it's screwed up from the POST values to the $update statement. I may be wrong but that's from testing
– macnotapplesessor
Nov 24 '18 at 23:12
|
show 1 more comment
Are you missing a space between ‘$Inactive’ and your Where clause in the update query?
– Adam Brinded
Nov 24 '18 at 20:27
Also, add the lines ‘$arr = sqlsrv_errors();’ and ‘foreach ($arr as $value) { echo $value; }’
– Adam Brinded
Nov 24 '18 at 20:32
Never used those before so I wasn't sure where to add it so I added it below sqlsrv_query($Sconn, $update) ;. It outputs "Array" only.
– macnotapplesessor
Nov 24 '18 at 20:48
I misread the documentation on that, (php.net/manual/en/function.sqlsrv-errors.php). You are correct in the placement of it. Remove the foreach loop entirely and instead use ‘var_dump($arr);’. This will show any SQL error that may be there, or NULL if no error
– Adam Brinded
Nov 24 '18 at 23:03
I changed it as you described and came back with 'NULL'. Just FYI I added a raw $update statement with values not deriving for the POST data and that did execute and change the records in SQL. Seems like it's screwed up from the POST values to the $update statement. I may be wrong but that's from testing
– macnotapplesessor
Nov 24 '18 at 23:12
Are you missing a space between ‘$Inactive’ and your Where clause in the update query?
– Adam Brinded
Nov 24 '18 at 20:27
Are you missing a space between ‘$Inactive’ and your Where clause in the update query?
– Adam Brinded
Nov 24 '18 at 20:27
Also, add the lines ‘$arr = sqlsrv_errors();’ and ‘foreach ($arr as $value) { echo $value; }’
– Adam Brinded
Nov 24 '18 at 20:32
Also, add the lines ‘$arr = sqlsrv_errors();’ and ‘foreach ($arr as $value) { echo $value; }’
– Adam Brinded
Nov 24 '18 at 20:32
Never used those before so I wasn't sure where to add it so I added it below sqlsrv_query($Sconn, $update) ;. It outputs "Array" only.
– macnotapplesessor
Nov 24 '18 at 20:48
Never used those before so I wasn't sure where to add it so I added it below sqlsrv_query($Sconn, $update) ;. It outputs "Array" only.
– macnotapplesessor
Nov 24 '18 at 20:48
I misread the documentation on that, (php.net/manual/en/function.sqlsrv-errors.php). You are correct in the placement of it. Remove the foreach loop entirely and instead use ‘var_dump($arr);’. This will show any SQL error that may be there, or NULL if no error
– Adam Brinded
Nov 24 '18 at 23:03
I misread the documentation on that, (php.net/manual/en/function.sqlsrv-errors.php). You are correct in the placement of it. Remove the foreach loop entirely and instead use ‘var_dump($arr);’. This will show any SQL error that may be there, or NULL if no error
– Adam Brinded
Nov 24 '18 at 23:03
I changed it as you described and came back with 'NULL'. Just FYI I added a raw $update statement with values not deriving for the POST data and that did execute and change the records in SQL. Seems like it's screwed up from the POST values to the $update statement. I may be wrong but that's from testing
– macnotapplesessor
Nov 24 '18 at 23:12
I changed it as you described and came back with 'NULL'. Just FYI I added a raw $update statement with values not deriving for the POST data and that did execute and change the records in SQL. Seems like it's screwed up from the POST values to the $update statement. I may be wrong but that's from testing
– macnotapplesessor
Nov 24 '18 at 23:12
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462041%2fphp-updating-ms-sql-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53462041%2fphp-updating-ms-sql-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you missing a space between ‘$Inactive’ and your Where clause in the update query?
– Adam Brinded
Nov 24 '18 at 20:27
Also, add the lines ‘$arr = sqlsrv_errors();’ and ‘foreach ($arr as $value) { echo $value; }’
– Adam Brinded
Nov 24 '18 at 20:32
Never used those before so I wasn't sure where to add it so I added it below sqlsrv_query($Sconn, $update) ;. It outputs "Array" only.
– macnotapplesessor
Nov 24 '18 at 20:48
I misread the documentation on that, (php.net/manual/en/function.sqlsrv-errors.php). You are correct in the placement of it. Remove the foreach loop entirely and instead use ‘var_dump($arr);’. This will show any SQL error that may be there, or NULL if no error
– Adam Brinded
Nov 24 '18 at 23:03
I changed it as you described and came back with 'NULL'. Just FYI I added a raw $update statement with values not deriving for the POST data and that did execute and change the records in SQL. Seems like it's screwed up from the POST values to the $update statement. I may be wrong but that's from testing
– macnotapplesessor
Nov 24 '18 at 23:12