Re: Problema con MySQL
| From: | Juan Ringhetti | Date: | Tue, 03 Feb 2004 20:23:24 +0000 |
| Subject: | Re: Problema con MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32771@lists.php.net to get a copy of this message | ||
Marco,
veo lo siguiente:
estás utilizando la sentencia db_connect() en lugar de
mysql_connect("parametros de conexion") y está faltándote
mysql_select_db(base, link); para seleccionar la base de datos que tiene la
tabla articulo_boletin.
el resto parece estar todo 10 puntos.
Saludos
Juan
Lic. Juan Angel Ringhetti
Dirección de Informática
Secretaría de Investigación, Ciencia y Técnica
Universidad Nacional de Lanús
29 de Septiembre 3901 - Remedios de Escalada - Lanús
Te: 011-6322-9200 int. 217
email: jringhetti@unla.edu.ar
-------------------------------------------
Marco,
I can observe the following:
you have the unknown db_connect() sentence instead mysql_connect() and in
the script you haven't got the mysql_select_db(base,link) sentence to reach
a database wich owns the articulo_boletin table.
The rest of your script it's right.
Excuse my english ;-)
Juan
----- Original Message -----
From: "Rolf van de Krol" <rolf@rolfvandekrol.nl>
To: <php-db@lists.php.net>
Sent: Tuesday, February 03, 2004 3:46 PM
Subject: RE: [PHP-DB] Problema con MySQL
Hi Marco,
Please use ENGLISH. This mailinglist is english.
Rolf
-----Oorspronkelijk bericht-----
Van: Marco A. Ortiz [mailto:aortizma@unal.edu.co]
Verzonden: zaterdag 31 januari 2004 16:45
Aan: php-db@lists.php.net; php-evangelism@lists.php.net
Onderwerp: RE: [PHP-DB] Problema con MySQL
Buenos días a todos:
Espero que alguno de ustedes hable español y me pueda ayudar a descubrir qué
está mal en el siguiente código:
El objetivo de la función es acceder a una base de Datos (MySQL) y mostrar
los registros que cumplan cierta condición. Si no existe ningún registro
que cumpla la condición, despliega un mensaje informa al usuario de la
situación, de lo contrario, muestra en una tabla cada uno de los registro
encontrados acompañados de las opciones "Eliminar" y "Editar".
Por lo menos esto debería hacer. El problema es que no muestra el primero de
los registros que cumplen la condición. Le he dado mil vueltas y no he
logrado encontrar el error.
function mostrar_articulos_admin($boletin)
{
if (!$boletin == NULL)
{
$conn = db_connect();
$query = "select id_articulo, titulo_articulo,
autor_articulo from articulo_boletin where id_boletin=$boletin";
$result = mysql_query($query, $conn);
$row = 0;
$hay_arts = mysql_fetch_row ($result);
if ($hay_arts)
{
echo "<h1>Artículos correspondientes al Boletín
$boletin</h1>";
echo "<p>\n
<table width=\"70%\"
align=\"center\" cellspacing=0>\n
<tr>\n
<td><b>Detalle
Artículo</b></td>\n
<td
align=\"center\"><b>Eliminar</b></td>\n
<td
align=\"center\"><b>Editar</b></td>\n
</tr>";
while ($fila = mysql_fetch_array($result,
MYSQL_NUM))
{
$row++;
echo "<tr
bgcolor=\"".color_fila($row)."\">\n";
echo
"<td><p><b>$fila[2]</b><br><i>$fila[3]</i></p></td>\n";
echo "<td
align=\"center\"><a
href=\"proces.php?action=delart&articulo=$fila[0]\">
<img
src=\"../boletines/ima/eliminar.gif\" border=0></a></td>\n";
echo "<td
align=\"center\"><a
href=\"proces.php?action=editart&articulo=$fila[0]\">
<img
src=\"../boletines/ima/editar.gif\" border=0></a></td>\n";
echo "</tr>\n";
}
echo "</table><br></p>";
}
else
{
echo "<p>No existe ningún Artìculo asociado a este
Boletín.<br><br></p>";
}
}
else
{
echo "<p>No ha indicado un número de Boletin Válido,
verifique la información e intente de nuevo.</p>";
}
}
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php