
PHP SQLSERVER Procedimiento almacenado
Publicado por agu (6 intervenciones) el 17/08/2016 05:14:43
hola necesito ejecutar un procedimiento almacenado en una base de datos SQL Server, este procedimiento es un procedimiento de insercion de datos el cual recibe datos enviados desde php. Este es el codigo que utilizo:
este es el error que me aparece:
Fatal error: core_sqlsrv_bind_param: invalid encoding in C:\xampp\htdocs\proyecto\Altaempresa.php on line 61
muchas gracias por su ayuda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<html>
<head>
</head>
<body>
<form method="post" action="Altaempresa.php" >
Razon Social:<br>
<input type="text" name="razonsocial" /> <br>
CUIT:<br>
<input type="text" name="cuit" /> <br>
Direccion:<br>
<input type="text" name="direccion" /> <br>
Piso:<br>
<input type="text" name="piso" /> <br>
Numero de departamento:<br>
<input type="text" name="numerodepartamento" /> <br>
Email:<br>
<input type="text" name="mail" ><br><br>
<input type="submit" value="Ingreso" name="Ingresar" />
</form>
</body>
</html>
<?php
$server = 'USUARIO-PC\AGU';
$connectionInfo = array("Database"=>"GESTION-IMT", "UID"=>"sa", "PWD"=>"123");
$conexion = sqlsrv_connect($server, $connectionInfo);
if( $conexion )
{
echo "Conexión establecida.<br />";
if (isset($_POST["Ingresar"]))
{
$razonsocial = $_POST['razonsocial'];
$cuit = $_POST['cuit'];
$direccion = $_POST['direccion'];
$piso = $_POST['piso'];
$numerodepartamento = $_POST['numerodepartamento'];
$mail= $_POST['mail'];
$sql = "{CALL AltaEmpresa values(?, ?, ?, ?, ?, ?)}";
$params = array(
array($razonsocial, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(50)),
array($cuit, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(11)),
array($direccion, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(50)),
array($piso, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_INT, SQLSRV_SQLTYPE_INT),
array($numerodepartamento, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(4)),
array($mail, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), SQLSRV_SQLTYPE_VARCHAR(50))
);
$stmt = sqlsrv_query($conexion, $sql, $params); //en esta linea esta el problema='/img/emoticons/angry.gif' width='22' height='22' border='0' />
='/img/emoticons/angry.gif' width='22' height='22' border='0' />
if($stmt === false)
{
echo "Algo salio mal";
die(print_r(sqlsrv_errors(), true));
}
}
}
else
{
echo "Conexión no se pudo establecer.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
este es el error que me aparece:
Fatal error: core_sqlsrv_bind_param: invalid encoding in C:\xampp\htdocs\proyecto\Altaempresa.php on line 61
muchas gracias por su ayuda
Valora esta pregunta


0