English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories


//Verifica credenciales del usuario
include_once "include/ch.....php";
//Se conecta a base de datos
include_once "include/conn.....php";
$id_cable = $_POST['id_cable'];
$id_admin = $_POST['id_admin'];
$id_tipo_enlace = $_POST['id_tipo_enlace'];

/*Elimina los registros de la base de datos*/
if
(isset
($_POST['submit']){
if($id_admin > 0){
mysql_query="DELETE FROM administracion WHERE id_admin = $id_admin";
}
elseif($id_tipo_enlace > 0){
mysql_query="DELETE FROM tipo_enlace WHERE id_tipo_enlace = $id_tipo_enlace";
}
elseif{
mysql_query("DELETE FROM cable WHERE id_cable = $id_cable");
}
}

/*Call the three select from the DB*/
.....................





2007-08-03 08:09:04 · 4 answers · asked by priscilla l 1 in Computers & Internet Programming & Design

4 answers

//add your database connection here

if(isset( $_POST['deleteRecord'])){

if(is_numeric($_POST['id'])){

$id=$_POST['id'];
$tableName = $_POST['tableToDelete'];

if($tableName == 'administration'){
mysql_query="DELETE FROM administracion WHERE id_admin = $id";
$recordDelete = TRUE;
}
elseif(tableName == 'tipo_enlace'){
mysql_query="DELETE FROM tipo_enlace WHERE id_tipo_enlace = $id";
$recordDelete = TRUE;
}
elseif($tableName == 'cable'){
mysql_query("DELETE FROM cable WHERE id_cable = $id";
$recordDelete = TRUE;
}
else{
print "You must select a valid table to delete. Please try again.";
}
}
else{
print "You must select a valid table and id to delete. Please try again.";
}
}

?>
The record was deleted.

action=" method="POST">

Delete From Table:
Administration
Tipo Enlace
Cable


Record Id:




if thats what your looking to do heres a quick fix - one thing I rushed through on the first is the last elseif you originally got
// 'SCRIPT_FI... should be 'SCRIPT_FILENAME']?>"

2007-08-03 08:20:17 · answer #1 · answered by Big D 4 · 0 1

Get rid of at the top.
include_once should look like this:

include_once("stuff");

The if(isset($_POST['submit']){
Needs to look like this
if(isset($_POST['submit'])){

all mysql_query must look like this:

mysql_query("stuff");

(optional:)elseif's can look like this:

else if

for the form you need to put it in an echo like so:

echo '

';

etc... Put everything from your to
inside that echo

You're missing an ending > on the last


I recommend reading this tutorial: http://w3schools.com
It's very helpful for learning php. :)

2007-08-03 15:17:41 · answer #2 · answered by ChipChamp 4 · 0 1

2 things, do not put the '' around the variable names in the POST variables, and I believe you need the English button as the class.

2007-08-03 15:38:43 · answer #3 · answered by Anonymous · 0 2

(isset
($_POST['submit']){
if($id_admin > 0){

looks like your missing a )


(isset
($_POST['submit'])){
if($id_admin > 0){

2007-08-03 15:13:25 · answer #4 · answered by apcyberax 3 · 1 1

fedest.com, questions and answers