Update Working
Hi,
I have a very simple page as way of a test which is not working with an update. I followed the steps to create this and the resulting code is :
<?php require_once('Connections/PWS_Conn.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php require_once('webassist/mysqli/queryobj.php'); ?>
<?php
$RS_PWS = new WA_MySQLi_RS("RS_PWS",$PWS_Conn,1);
$RS_PWS->setQuery("SELECT * FROM pws_clients WHERE ID = ?");
$RS_PWS->bindParam("i", "".(isset($_GET['ID'])?$_GET['ID']:"") ."", "-1"); //colname
$RS_PWS->execute();
?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$UpdateQuery = new WA_MySQLi_Query($PWS_Conn);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "pws_clients";
$UpdateQuery->bindColumn("Fname", "s", "".($RS_PWS->getColumnVal("Fname")) ."", "WA_DEFAULT");
$UpdateQuery->bindColumn("Lname", "s", "".($RS_PWS->getColumnVal("Lname")) ."", "WA_DEFAULT");
$UpdateQuery->addFilter("ID", "=", "i", "".($_GET['ID']) ."");
$UpdateQuery->execute();
$UpdateGoTo = "updated.php";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="css/pws.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="form-style-8"><img src="assets/emails/pws_logo.png" width="126" height="127" alt=""/><br>
<br>
<strong>Welcome<br>
<?php echo($RS_PWS->getColumnVal("Fname")); ?></strong></div>
<div class="form-style-8">
<h2>Register for the VIP EVENT</h2>
<form action="" method="post" name="ClientsReg" id="ClientsReg">
<p>
<label for="Fname">First Name:</label>
<input name="Fname" type="text" id="Fname" value="<?php echo($RS_PWS->getColumnVal("Fname")); ?>">
</p>
<p>
<input type="submit" name="submit" id="submit" value="Submit">
</p>
</form>
</div>
</body>
</html>
BUT - it redirects to the updated page - but the record has not been updated...Any help would be appreciated