MySQLi Update Record with parameter in the goto throws a Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
Hello there:
When I try to load the update record form page in order to enter the data to update, I'm getting the following parse error on the $UpdateGoTo line:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\wamp\www\prueba_update.php on line 18
I'm almost sure the issue is related to the way the behavior constructs the goto url string, since this only happens when I'm passing a parameter on the "After updating, goto:" popup window that is built by Dreamweaver CS6 parameter button generator.
I tried avoiding to pass any parameters in the goto and adding it by hand after the behavior generated the update code and of course it works, but (I assume) because of the handcoding, the server behaviors panel stops showing the update behavior after I altered the original code.
Update Note: Same thing is happening with de MySQLi Insert Record behaviors.
This is the page code:
<?php require_once('Connections/conn.php'); ?>
<?php require_once('webassist/mysqli/rsobj.php'); ?>
<?php require_once('webassist/mysqli/queryobj.php'); ?>
<?php
$rsGrupo = new WA_MySQLi_RS("rsGrupo",$conn,1);
$rsGrupo->setQuery("SELECT * FROM modulos_sistema_grupos WHERE id_modulo_sistema_grupo = ?");
$rsGrupo->bindParam("i", "".(isset($_GET['grupo'])?$_GET['grupo']:"") ."", "-1"); //colname
$rsGrupo->execute();
?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$UpdateQuery = new WA_MySQLi_Query($conn);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "modulos_sistema_grupos";
$UpdateQuery->bindColumn("orden", "i", "".((isset($_POST["orden"]))?$_POST["orden"]:"") ."", "WA_DEFAULT");
$UpdateQuery->addFilter("id_modulo_sistema_grupo", "=", "i", "".((isset($_POST["grupo"]))?$_POST["grupo"]:"") ."");
$UpdateQuery->execute();
$UpdateGoTo = "sistema_grupos.php?modulo=\" . echo((isset($_POST[\"modulo\"]))?$_POST[\"modulo\"]:\"\") . \"";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sin título</title>
</head>
<body>
<form name="form1" method="post" action="">
<table>
<tr>
<td>Orden:</td>
<td><input name="orden" type="text" id="orden" value="<?php echo($rsGrupo->getColumnVal("orden")); ?>"></td>
</tr>
<tr>
<td><input name="modulo" type="text" id="modulo" value="<?php echo $_GET['modulo']; ?>">
<input name="grupo" type="text" id="grupo" value="<?php echo $_GET['grupo']; ?>"></td>
<td><input type="submit" name="button" id="button" value="Enviar"></td>
</tr>
</table>
</form>
</body>
</html>
Thanks,
Ramiro.