i haveWarning: Undefined variable $rsnew in C:\xampp\htdocs\pruebas\models\Remates.php on line 246Warning: Undefined variable $rsnew in C:\xampp\htdocs\pruebas\models\Remates.php on line 449Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\pruebas\src\userfn.php on line 514
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1This is my code
function BuscoUltimoSerie($rsnew) {
$hostname_amercado = isset($_SERVER['DB_HOSTNAME']) ? $_SERVER['DB_HOSTNAME'] : "vm3.adrianmercado.com.ar";
$database_amercado = isset($_SERVER['DB_DATABASE']) ? $_SERVER['DB_DATABASE'] : "am_test";
$username_amercado = isset($_SERVER['DB_USER']) ? $_SERVER['DB_USER'] : "am_test_user";
$password_amercado = isset($_SERVER['DB_PASSWORD']) ? $_SERVER['DB_PASSWORD'] : "IV20pRY3VkAcIcs";
// LEO LA TABLA SERIES
$amercado = mysqli_connect($hostname_amercado, $username_amercado, $password_amercado) or trigger_error(mysqli_error($amercado),E_USER_ERROR);
// BUSCO LOS CAMPOS NECESARIOS PARA VALIDAR
$serie = $rsnew['serie'];
// LEO LA TABLA SERIES
mysqli_select_db($amercado, $database_amercado);
$query = sprintf("SELECT * FROM series WHERE series.codnum = $serie");
$Result = mysqli_query($amercado, $query) or die(mysqli_error($amercado));
$row_Result = mysqli_fetch_assoc($Result);
$nroact = $row_Result['nroact'];
return $nroact + 1;
}
You did not post how you pass $rsnew to your own function, you need to post lines near 246 and 449 in Remates.php, and lines near 514 in userfn.php. Make sure you pass $rsnew correctly.
You cannot use $rsnew in AutoUpdate value, there is no $rsnew in the context. The $rsnew is only available in server events such as Row_Inserting/Inserted/Updating/Updated.In fact your function BuscoNuevoRemate() does not use $rsnew at all, you should change BuscoNuevoRemate($rsnew) to BuscoNuevoRemate().