Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/05/2014, 06:25
blackmel25
 
Fecha de Ingreso: enero-2010
Mensajes: 59
Antigüedad: 16 años, 9 meses
Puntos: 0
funciones de php 5 que sustituyen a php 4 con realcion mysql?

Hola

Desde ya gracias por leer este mensaje, paso a explicarme. Estoy realizando una web de info de cine pero tengo problemas con mi código php y es que me pide que lo actualice a php 5 mi problema radica en que no soy muy bueno con php o programación a objectos de hecho mi proyecto lo hacia desde dreamweaver cs5 donde solo seleccionaba que deseaba hacer. pero ahora necesito cambiar...

me podrían ayudar a actualizar este código?

Código 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;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_DatosPeliculaEnIndex = 40;
$pageNum_DatosPeliculaEnIndex = 1;
if (isset(
$_GET['pageNum_DatosPeliculaEnIndex'])) {
  
$pageNum_DatosPeliculaEnIndex = $_GET['pageNum_DatosPeliculaEnIndex'];
}

$startRow_DatosPeliculaEnIndex = ($pageNum_DatosPeliculaEnIndex - 1) * $maxRows_DatosPeliculaEnIndex;

mysqli_connect($database_conexionpeli, $conexionpeli);
$query_DatosPeliculaEnIndex = "SELECT * FROM tbpelicula ORDER BY tbpelicula.id_pelicula DESC";
$query_limit_DatosPeliculaEnIndex = sprintf("%s LIMIT %d, %d", $query_DatosPeliculaEnIndex, $startRow_DatosPeliculaEnIndex, $maxRows_DatosPeliculaEnIndex);
$DatosPeliculaEnIndex = mysql_query($query_limit_DatosPeliculaEnIndex, $conexionpeli) or die(mysql_error());
$row_DatosPeliculaEnIndex = mysql_fetch_assoc($DatosPeliculaEnIndex);

if (isset(
$_GET['totalRows_DatosPeliculaEnIndex'])) {
  
$totalRows_DatosPeliculaEnIndex = $_GET['totalRows_DatosPeliculaEnIndex'];
} else {
  
$all_DatosPeliculaEnIndex = mysql_query($query_DatosPeliculaEnIndex);
  
$totalRows_DatosPeliculaEnIndex = mysql_num_rows($all_DatosPeliculaEnIndex);
}
$totalPages_DatosPeliculaEnIndex = ceil($totalRows_DatosPeliculaEnIndex/$maxRows_DatosPeliculaEnIndex);

$queryString_DatosPeliculaEnIndex = "";
if (!empty(
$_SERVER['QUERY_STRING'])) {
  
$params = explode("&", $_SERVER['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param, "pageNum_DatosPeliculaEnIndex") == false && 
        
stristr($param, "totalRows_DatosPeliculaEnIndex") == false) {
      
array_push($newParams, $param);
    }
  }
  if (
count($newParams) != 1) {
    
$queryString_DatosPeliculaEnIndex = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_DatosPeliculaEnIndex = sprintf("&totalRows_KLKEstoSeBorraraKLK=%d%s", $totalRows_DatosPeliculaEnIndex, $queryString_DatosPeliculaEnIndex);

?>