Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/08/2010, 03:44
DavidBL
 
Fecha de Ingreso: diciembre-2009
Ubicación: España
Mensajes: 380
Antigüedad: 14 años, 4 meses
Puntos: 1
Exclamación Ayudita PHP y bases de datos

Hola verán tengo un problema tengo un código como este(es un ejemplo con el mismo problema):
Cita:
<?php require_once('Connections/www.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_www, $www);
$query_Recordset1 = "SELECT * FROM www";
$Recordset1 = mysql_query($query_Recordset1, $www) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$numero1 = $row_Recorset['numero'];
$numero = 1;
//imaginemos que en la base de datos hay 3 datos numero(4,2 y 4)
if($numero < $numero1){
mysql_query("DELETE FROM www WHERE id=$id");
} else {}
mysql_free_result($Recordset1);
?>
El problema es que borraria uno de los 3 datos, pero yo querria que borrase todos los datos que cumpliesen la condicion
¿Como se podría hacer?
Gracias adelantadas