23/05/2009, 09:28
|
| | Fecha de Ingreso: mayo-2007
Mensajes: 140
Antigüedad: 17 años Puntos: 6 | |
Respuesta: charset=utf-8, las tildes y eñes y utf8_spanish_ci si te parece te pego aqui la base de datos y el php de unos tutoriales que pense podian tenerlo solucionado.
Código:
-- phpMyAdmin SQL Dump
-- version 3.1.1
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 23-05-2009 a las 17:20:18
-- Versión del servidor: 5.1.30
-- Versión de PHP: 5.2.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Base de datos: `tilde`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `autores`
--
CREATE TABLE IF NOT EXISTS `autores` (
`autor_id` int(7) NOT NULL AUTO_INCREMENT,
`nombre` varchar(30) COLLATE utf8_spanish_ci NOT NULL,
`apellidos` varchar(30) COLLATE utf8_spanish_ci NOT NULL,
PRIMARY KEY (`autor_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci AUTO_INCREMENT=11 ;
--
-- Volcar la base de datos para la tabla `autores`
--
INSERT INTO `autores` (`autor_id`, `nombre`, `apellidos`) VALUES
(1, 'José', 'Pérez'),
(4, 'Andrés', 'Caño'),
(5, 'niño', 'García'),
(7, '', 'Sócrates'),
(8, 'García', 'Márquez'),
(9, 'peña', 'España'),
(10, 'Joaquín', 'Sabina');
Código PHP: <?php require_once('Connections/tutorial.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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_listaAutores = 5; $pageNum_listaAutores = 0; if (isset($_GET['pageNum_listaAutores'])) { $pageNum_listaAutores = $_GET['pageNum_listaAutores']; } $startRow_listaAutores = $pageNum_listaAutores * $maxRows_listaAutores; mysql_select_db($database_tutorial, $tutorial); $query_listaAutores = "SELECT * FROM autores ORDER BY autores.apellidos, autores.nombre"; $query_limit_listaAutores = sprintf("%s LIMIT %d, %d", $query_listaAutores, $startRow_listaAutores, $maxRows_listaAutores); $listaAutores = mysql_query($query_limit_listaAutores, $tutorial) or die(mysql_error()); $row_listaAutores = mysql_fetch_assoc($listaAutores); if (isset($_GET['totalRows_listaAutores'])) { $totalRows_listaAutores = $_GET['totalRows_listaAutores']; } else { $all_listaAutores = mysql_query($query_listaAutores); $totalRows_listaAutores = mysql_num_rows($all_listaAutores); } $totalPages_listaAutores = ceil($totalRows_listaAutores/$maxRows_listaAutores)-1; $queryString_listaAutores = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_listaAutores") == false && stristr($param, "totalRows_listaAutores") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_listaAutores = "&" . htmlentities(implode("&", $newParams)); } } $queryString_listaAutores = sprintf("&totalRows_listaAutores=%d%s", $totalRows_listaAutores, $queryString_listaAutores); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Documento sin título</title> <style type="text/css"> <!-- #recNav { width: 400px; } .alinDerecha { text-align: right; } --> </style> </head> <body> <h1>Autores Registrados</h1> <table width="450" border="0"> <tr> <td><div align="center"><strong>Autor</strong></div></td> </tr> <?php do { ?> <tr> <td><?php echo $row_listaAutores['nombre']; ?> <?php echo $row_listaAutores['apellidos']; ?></td> </tr> <?php } while ($row_listaAutores = mysql_fetch_assoc($listaAutores)); ?> </table> <p> </p> </body> </html> <?php mysql_free_result($listaAutores); ?> y como verás el resultado es este: |