Muchachos me dirijo a ustedes por una duda que tengo
tengo un formulario que se encarga de buscar y eliminar ofertas
el problema es que al pinchar en eliminar me arroja el siguiente error firebug
( ! ) Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\prueba\php\eliminar_oferta.php on line 9 Call Stack # Time Memory Function Location 1 0.0014 673760 {main}( ) ..\eliminar_oferta.php:0 2 0.0677 681336 mysql_fetch_assoc ( ) ..\eliminar_oferta.php:9
( ! ) Notice: Undefined variable: data in C:\wamp\www\prueba\php\eliminar_oferta.php on line 14 Call Stack # Time Memory Function Location 1 0.0014 673760 {main}( ) ..\eliminar_oferta.php:0
null
lo curioso es que al ver en la base de datos el registro se elimina
segun lei es un problema con la consulta, pero la probe en el motor y funciona
A continuacion dejo parte del codigo involucrado
eliminar_oferta.php
esto en el js
/*****************************************
* EVENTO CLICK BOTON ELIMINAR**
*****************************************/
$("#btn_eliminar_bo").click(function(){
url = "php/eliminar_oferta.php";
$.getJSON(url, {nom_oferta : $("#txt_nom_ofertb").val()
}
,function(datos) {
if(datos==true){
alert("Ingresado!");
}else{
msg_error_guardar();
}
});
});
formulario
tengo un formulario que se encarga de buscar y eliminar ofertas
el problema es que al pinchar en eliminar me arroja el siguiente error firebug
( ! ) Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\prueba\php\eliminar_oferta.php on line 9 Call Stack # Time Memory Function Location 1 0.0014 673760 {main}( ) ..\eliminar_oferta.php:0 2 0.0677 681336 mysql_fetch_assoc ( ) ..\eliminar_oferta.php:9
( ! ) Notice: Undefined variable: data in C:\wamp\www\prueba\php\eliminar_oferta.php on line 14 Call Stack # Time Memory Function Location 1 0.0014 673760 {main}( ) ..\eliminar_oferta.php:0
null
lo curioso es que al ver en la base de datos el registro se elimina
segun lei es un problema con la consulta, pero la probe en el motor y funciona
A continuacion dejo parte del codigo involucrado
eliminar_oferta.php
<?php
require_once('..\php\conexion.php');
$varnombre_oferta = $_GET['nom_oferta'];
$consulta = "delete from oferta where nom_oferta = '".$varnombre_oferta."'";
$result = mysql_query($consulta);
while($consulta = mysql_fetch_assoc($result)) :
$data[] = $consulta;
endwhile;
echo json_encode($data);
?>
require_once('..\php\conexion.php');
$varnombre_oferta = $_GET['nom_oferta'];
$consulta = "delete from oferta where nom_oferta = '".$varnombre_oferta."'";
$result = mysql_query($consulta);
while($consulta = mysql_fetch_assoc($result)) :
$data[] = $consulta;
endwhile;
echo json_encode($data);
?>
esto en el js
/*****************************************
* EVENTO CLICK BOTON ELIMINAR**
*****************************************/
$("#btn_eliminar_bo").click(function(){
url = "php/eliminar_oferta.php";
$.getJSON(url, {nom_oferta : $("#txt_nom_ofertb").val()
}
,function(datos) {
if(datos==true){
alert("Ingresado!");
}else{
msg_error_guardar();
}
});
});
formulario
<form id="form_ingres
ferta">
<table>
<tr>
<td bgcolor="#e6f9ff"><h2>Nombre de la Oferta:</h2></td>
<td bgcolor="#e6f9ff"><input type="text" id="txt_nom_ofertb" /></td>
</tr>
<tr>
<td bgcolor="#f8fae8"><h2>Sueldo :</h2></td>
<td bgcolor="#f8fae8"><input type="text" id="txt_sueldob"/></td>
</tr>
<tr>
<td bgcolor="e6f9ff"><h2>Detalles:</h2></td>
<td bgcolor="e6f9ff"><textarea name="mensaje" cols="50" rows="5" id="txt_detalleb"></textarea> </td>
</tr>
</tr>
<td bgcolor="#f8fae8"><h2>Perfil:</h2></td>
<td bgcolor="#f8fae8"> <select id="txt_perfilb">
<option value=0> Seleccione</option>
</select></td>
</tr>
</table>
</form>
<br><br>
<button id="btn_buscar_bo">Buscar</button>
<button id="btn_actualizar_bo">Actualizar</button>
<button id="btn_eliminar_bo">Eliminar</button>
<table>
<tr>
<td bgcolor="#e6f9ff"><h2>Nombre de la Oferta:</h2></td>
<td bgcolor="#e6f9ff"><input type="text" id="txt_nom_ofertb" /></td>
</tr>
<tr>
<td bgcolor="#f8fae8"><h2>Sueldo :</h2></td>
<td bgcolor="#f8fae8"><input type="text" id="txt_sueldob"/></td>
</tr>
<tr>
<td bgcolor="e6f9ff"><h2>Detalles:</h2></td>
<td bgcolor="e6f9ff"><textarea name="mensaje" cols="50" rows="5" id="txt_detalleb"></textarea> </td>
</tr>
</tr>
<td bgcolor="#f8fae8"><h2>Perfil:</h2></td>
<td bgcolor="#f8fae8"> <select id="txt_perfilb">
<option value=0> Seleccione</option>
</select></td>
</tr>
</table>
</form>
<br><br>
<button id="btn_buscar_bo">Buscar</button>
<button id="btn_actualizar_bo">Actualizar</button>
<button id="btn_eliminar_bo">Eliminar</button>