Ver Mensaje Individual
  #50 (permalink)  
Antiguo 02/05/2016, 01:09
Avatar de jearj
jearj
 
Fecha de Ingreso: julio-2008
Mensajes: 72
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: insertar url en campo de db al iniciar sesion los usuarios

Esto es del sistema de Noticias que tengo
He cambiado todas las pag a mysqli y me da estos errores:


Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in /homepages/1/d342648143/htdocs/niduda/publicar/anuncios/juego-registro.php on line 43

Warning: mysqli_query() expects parameter 1 to be mysqli, string given in /homepages/1/d342648143/htdocs/niduda/publicar/anuncios/juego-registro.php on line 47

Warning: mysqli_error() expects exactly 1 parameter, 0 given in /homepages/1/d342648143/htdocs/niduda/publicar/anuncios/juego-registro.php on line 47


Este es el codigo con las lineas 43 y 47 marcadas con texto rojo:


<?php
error_reporting(E_ALL^E_NOTICE);
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("mysqli_real_escape_string") ? mysqli_real_escape_string($theValue) : mysqli_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_noticias = 1;
$pageNum_noticias = 0;
if (isset($_GET['pageNum_noticias'])) {
$pageNum_noticias = $_GET['pageNum_noticias'];
}
$startRow_noticias = $pageNum_noticias * $maxRows_noticias;

mysqli_select_db($bd, $conexion); <-------- Línea 43
$query_noticias = "SELECT * FROM anuncios ORDER BY id_noticia ASC";
$query_limit_noticias = sprintf("%s LIMIT %d, %d", $query_noticias, $startRow_noticias, $maxRows_noticias);
$sitema='<!------texto aqui---------->';
$noticias = mysqli_query($query_limit_noticias, $conexion) or die(mysqli_error()); <-------- Línea 47
$row_noticias = mysqli_fetch_assoc($noticias);

if (isset($_GET['totalRows_noticias'])) {
$totalRows_noticias = $_GET['totalRows_noticias'];
} else {
$all_noticias = mysqli_query($query_noticias);
$totalRows_noticias = mysqli_num_rows($all_noticias);
}
$totalPages_noticias = ceil($totalRows_noticias/$maxRows_noticias)-1;$maxRows_noticias =4;
$pageNum_noticias = 0;
if (isset($_GET['pageNum_noticias'])) {
$pageNum_noticias = $_GET['pageNum_noticias'];
}
$startRow_noticias = $pageNum_noticias * $maxRows_noticias;

mysqli_select_db($database_conexion, $conexion);
$query_noticias = "SELECT * FROM anuncios ORDER BY id_noticia DESC";
$query_limit_noticias = sprintf("%s LIMIT %d, %d", $queryi_noticias, $startRow_noticias, $maxRows_noticias);
$noticias = mysqli_query($query_limit_noticias, $conexion) or die(mysqli_error());
$row_noticias = mysqli_fetch_assoc($noticias);

if (isset($_GET['totalRows_noticias'])) {
$totalRows_noticias = $_GET['totalRows_noticias'];
} else {
$all_noticias = mysqli_query($query_noticias);
$totalRows_noticias = mysqli_num_rows($all_noticias);
}
$totalPages_noticias = ceil($totalRows_noticias/$maxRows_noticias)-1;

$queryString_noticias = "";
if (!empty($_SERVER['QUERY_STRING'])) {

$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_noticias") == false &&
stristr($param, "totalRows_noticias") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_noticias = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_noticias = sprintf("&totalRows_noticias=%d%s", $totalRows_noticias, $queryString_noticias);
$no='Si esta leyendo este mensaje es proque borraste los datos del autor';

?>

Estoy intentando pasar los códigos a mysqli, pero creo que dará mucho calentamientos de cabeza y no se si será posible mantener el mysqli.