Ver Mensaje Individual
  #11 (permalink)  
Antiguo 26/08/2011, 15:07
Avatar de PHPaniel
PHPaniel
 
Fecha de Ingreso: abril-2011
Mensajes: 16
Antigüedad: 13 años, 1 mes
Puntos: 2
Mensaje Respuesta: Problemas con los apostrofes al guardar registro en mysql con php

ESTE ES EL CODIGO QUE PROCESA CON LA QUE ESTOY TRABAJANDO, DONDE TENDRIA QUE MODIFICAR ESE addslashes() AMIGO darkasecas??? QUIZA DEBA MODIFICAR LA LINEA # 10 DE ESE MAGIC_QUOTES COMO TU DICES, DESDE YA LES AGRADEZCO SU AYUDA.

Código PHP:
<?php require_once('../../../Connections/dbcpanel.php'); ?>
<?php
mysql_select_db
($database_dbcpanel$dbcpanel);
require(
"../seguridad.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;
}
}

$colname_rsT "-1";
if (isset(
$_GET['idnoticia'])) {
  
$colname_rsT $_GET['idnoticia'];
}
mysql_select_db($database_dbcpanel$dbcpanel);
$query_rsT sprintf("SELECT * FROM osc_anios WHERE idnoticia = %s"GetSQLValueString($colname_rsT"int"));
$rsT mysql_query($query_rsT$dbcpanel) or die(mysql_error());
$row_rsT mysql_fetch_assoc($rsT);
$totalRows_rsT mysql_num_rows($rsT);
?>