PHP - ayuda php

 
Vista:

ayuda php

Publicado por morgan (8 intervenciones) el 03/02/2009 22:54:18
hola tengo el siguiente problema y ya no se como arreglar este codigo espero y me puedan ayudar, gracias.

Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][Controlador ODBC Microsoft Access] Error de sintaxis (falta operador) en la expresión de consulta 'proc_est=01 ACADEMICO and depto='DIRECCION' and proc_clave='7' meta='5' and accion='5' and partida='5''., SQL state 37000 in SQLExecDirect in C:wampwwwpoa1altascgbd.php on line 61

Warning: odbc_fetch_row(): supplied argument is no

en el siguiente codigo

<?php
if( isset($_REQUEST['muestracg']) )
{
$error = false;

if(empty($_REQUEST['proc_est']) ) $error = true;
if(empty($_REQUEST['proc_clave']) ) $error = true;
if(empty($_REQUEST['deptos']) ) $error = true;
if(empty($_REQUEST['meta']) ) $error = true;
if(empty($_REQUEST['accion']) ) $error = true;
if(empty($_REQUEST['partida']) ) $error = true;
if(empty($_REQUEST['pres_act']) ) $error = true;
if(empty($_REQUEST['tot_ejer']) ) $error = true;
if(empty($_REQUEST['fecha']) ) $error = true;

if(!$error){
?>
<table width="70" border="0" cellpadding="0">
<tr bgcolor="#FFFFFF">
<td>echo "PROCESO ESTRATEGICO:"</td>
<td>.$_POST['proc_est'].</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>echo "PROCESO CLAVE:"</td>
<td>.$_POST['proc_clave'].</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>echo "DEPARTAMENTOS:"</td>
<td>.$_POST['deptos'].</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>echo "METAS:"</td>
<td>.$_POST['meta'].</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>echo "ACCION:"</td>
<td>.$_POST['accion'].</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>echo "PARTIDA:"</td>
<td>.$_POST['partida'].</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>echo "PRESUPUESTO ACT:"</td>
<td>.$_POST['pres_act'].</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>echo "TOTAL A EJERCER:"</td>
<td>.$_POST['tot_ejer'].</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>echo "FECHA:"</td>
<td>.$_POST['fecha'].</td>
</tr>
</table>
<?php
$conexion=odbc_connect("poa","","");

$poa=odbc_exec($conexion,"select pres_ejer as presup from poa where proc_est='$_POST[proc_est]' and depto='$_POST[deptos]' and proc_clave='$_POST[proc_clave]'
meta='$_POST[meta]' and accion='$_POST[accion]' and partida='$_POST[partida]';

while(odbc_fetch_row($poa))
{
$nuevopres=odbc_result($poa,'presup')- $_POST[tot_ejer];
echo "SU PRESUPUESTO DISPONIBLE ES:"['$nuevopres'];
}
$proclave=$_POST[proc_clave];
$proclave1=strtoupper($proclave);
$rs=odbc_exec($conexion,"select * from cont_gtos");
$sql="insert into cont_gtos (proc_est,proc_clave,deptos,meta,accion,partida,pres_act,tot_ejer,fecha) values
('$_POST[proc_est]',$proclave1,'$_POST[deptos]','$_POST[meta]','$_POST[accion]','$_POST[partida]','$_POST[pres_act]','$_POST[tot_ejer]','$_POST[fecha]')";
$rs=odbc_exec($conexion,$sql);
odbc_close_all();
echo " <script languaje="JavaScript"><!-- ",
" con = confirm('El Registro se Insertó Exitosamente\n¿Desea agregar otro registro\nde manera automática?'); ",
" if(con)location.href = 'cont_gast.html';else location.href = 'principal.html' ",
" --></script> ";
}
else
{
echo " <script languaje="JavaScript"><!-- ",
" alert('Introduzca correctamente los datos\nen los campos solicitados'); ",
" window.location.href = 'cont_gast.html' ",
" --></script> ";
ob_start( "header('Location:cont_gast.html');");
//echo " Usuario y Contraseña Incorrecta.... ";
exit;

}
}
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:ayuda php

Publicado por Juan Manuel Castañeda (52 intervenciones) el 03/02/2009 23:59:28
Compuebue si los parámetros de odbc_exec están el orden correcto.
Si lo están construya la consulta concatenando print o echo para cada valor de $_POST
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar