Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/02/2011, 17:53
iori093
 
Fecha de Ingreso: febrero-2011
Mensajes: 1
Antigüedad: 14 años, 1 mes
Puntos: 0
Sonrisa problema para conectarme con mysql

hola a todos pues hasta ahora estoy aprendiendo a crear bases de datos
y laverdad no he conseguido conectarme con la base de datos de el hosting gratuito 000webhosting.com

miren esto es lo que quiero hacer


pues es un taller de illasaron pues pense que lo que habia hecho estaba mal pero ni con lo mio ni con lo del taller de illasaron me ha funcionado


*** Este es el buscador



<html>
<head>
<title>layout</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (layout.psd) -->
<div id="Layer1" style="position:absolute; width:510px; height:306px; z-index:1; left: 235px; top: 242px;">
<form action="resultados.php" method="post">
<font color="#009900" size="-1" face="Century Gothic"><strong>Elige Tipo de Búsqueda:</strong></font><br>
<select name="searchtype">
<option value="autor">Autor
<option value="titulo">Título
<option value="isbn">ISBN
</select>
<br>
<font color="#009900" size="-1" face="Century Gothic"><strong>Escribe Término Búsqueda:</strong></font><br>
<input name="searchterm" type=text>
<br>
<input type=submit value="Buscar">
</form>
</div>
<table id="Tabla_01" width="761" height="601" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="Images/libreria_01.gif" width="40" height="182" alt=""></td>
<td colspan="3">
<img src="Images/libreria_02.gif" width="505" height="182" alt=""></td>
<td colspan="2">
<img src="Images/libreria_03.gif" width="206" height="182" alt=""></td>
<td rowspan="3">
<img src="Images/libreria_04.gif" width="9" height="225" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="182" alt=""></td>
</tr>
<tr>
<td rowspan="7">
<img src="Images/libreria_05.gif" width="40" height="198" alt=""></td>
<td>
<img src="Images/libreria_06.gif" width="198" height="31" alt=""></td>
<td colspan="4" rowspan="2">
<img src="Images/libreria_07.gif" width="513" height="43" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="31" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="Images/Button2.gif" width="198" height="31" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="12" alt=""></td>
</tr>
<tr>
<td colspan="3" rowspan="6">
<img src="Images/libreria_09.gif" width="497" height="268" alt=""></td>
<td colspan="2" rowspan="6">
<img src="Images/libreria_10.gif" width="25" height="268" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="19" alt=""></td>
</tr>
<tr>
<td>
<img src="Images/Button3.gif" width="198" height="31" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="31" alt=""></td>
</tr>
<tr>
<td>
<img src="Images/Button4.gif" width="198" height="31" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="31" alt=""></td>
</tr>
<tr>
<td>
<img src="Images/Button5.gif" width="198" height="31" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="31" alt=""></td>
</tr>
<tr>
<td>
<img src="Images/Button6.gif" width="198" height="43" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="43" alt=""></td>
</tr>
<tr>
<td colspan="2">
<img src="Images/libreria_15.gif" width="238" height="113" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="113" alt=""></td>
</tr>
<tr>
<td colspan="3">
<img src="Images/libreria_16.gif" width="279" height="107" alt=""></td>
<td colspan="2">
<img src="Images/libreria_17.gif" width="456" height="107" alt=""></td>
<td>
<img src="Images/libreria_18.gif" width="16" height="107" alt=""></td>
<td>
<img src="Images/libreria_19.gif" width="9" height="107" alt=""></td>
<td>
<img src="Images/espacio.gif" width="1" height="107" alt=""></td>
</tr>
<tr>
<td>
<img src="Images/espacio.gif" width="40" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="198" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="41" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="266" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="190" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="16" height="1" alt=""></td>
<td>
<img src="Images/espacio.gif" width="9" height="1" alt=""></td>
<td></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>


***Este es el archivo php que me muestra el resultado


<html>
<head>
<title>Resultados de la Búsqueda en la Librería Online</title>
</head>
<body>
<h1>Resultados de la Búsqueda en la Librería Online</h1>
<?
trim ($terminobusqueda);
if (!$tipobusqueda || !$terminobusqueda)
{
echo "No has introducido los detalles de la busqueda. Por favor vuelve e inténtalo de nuevo.";
exit;
}

$tipobusqueda = addslashes($tipobusqueda);
$terminobusqueda = addslashes($terminobusqueda);

@ $db = mysql_pconnect("www.puntomoviez.com.ar", "a8492879_1234", "***********");

if (!$db)
{
echo "Error: No se ha podido conectar a la base de datos. Por favor, prueba de nuevo más tarde.";
exit;
}

mysql_select_db("a8492879_123");
$consulta = "select * from libros where ".$tipobusqueda." like '%".$terminobusqueda."%'";
$resultado = mysql_query($consulta);

$num_resultados = mysql_num_rows($resultado);

echo "<p>Número de libros encontrados: ".$num_resultados."</p>";

for ($i=0; $i <$num_resultados; $i++)
{
$row = mysql_fetch_array($resultado);
echo "<p><strong>".($i+1).". Título: ";
echo stripslashes($row["titulo"]);
echo "</strong><br>Autor: ";
echo stripslashes($row["autor"]);
echo "<br>ISBN: ";
echo stripslashes($row["isbn"]);
echo "<br>Precio: ";
echo stripslashes($row["precio"]);
echo "</p>";
}

?>

</body>
</html>

espero me puedan ayudar para que miren lo que pasa
entren a
www.puntomoviez.com.ar