conexion remota al servidor mysql
Publicado por nicolas (1 intervención) el 28/07/2006 16:42:14
hola amigos les escribo porque tengo una inquietud, resulta que tengo una intranet en un colegio, instale apache, mysql y php en un equipo dejandolo como sevidor de base de datos, el problema es el siguente resulta que desarrolle un pequeño programa de ingreso de libros para la biblioteca resultando que remotamente no puedo ingresar un libro de otro computador arrojandome error de mysql_connect(), espero que me ayuden, gracias.
aqui les envio el codigo:
****ing_libro.php****
<? //Recupera los datos de BIBLIOTECA y los muestra en una tabla
$QUERY="SELECT * FROM libros;";
$link = mysql_connect("pc20","");
mysql_select_db("biblioteca", $link);
$result = mysql_query($QUERY);
if (mysql_num_rows($result) > 0) {
// Existen libros, los muestro
?>
<form name="form1" method="post" action="">
<table width="49%" border="1" align="center">
<tr>
<td><div align="center"><strong>TITULO</strong></div></td>
<td><div align="center"><strong>PRECIO</strong></div></td>
</tr>
<?
while ($reg=mysql_fetch_array($result)) {
echo "<tr>";
echo"<td>".$reg["titulo"]."</td>";
echo "<td>".$reg["precio"]."</td>";
echo"</tr>";
}
}
?>
******fin_ing_libro.php******
<?
$titulo=$_POST['titulo'];
$precio=$_POST['precio'];
$link = mysql_connect("pc20","");
mysql_select_db("biblioteca", $link);
$sql="INSERT INTO libros(titulo,precio)";
$sql.="VALUES('$titulo','$precio')";
$result=mysql_query($sql);
?>
<html>
<head>
<title>Ingreso de Datos</title>
</head>
<body>
<p> </p>
<p align="center"><strong>Datos Ingresados!</strong></p>
<p align="center"><strong><a href="ing_libro.php">Regresar al Menu</a></strong></p>
</body>
</html>
aqui les envio el codigo:
****ing_libro.php****
<? //Recupera los datos de BIBLIOTECA y los muestra en una tabla
$QUERY="SELECT * FROM libros;";
$link = mysql_connect("pc20","");
mysql_select_db("biblioteca", $link);
$result = mysql_query($QUERY);
if (mysql_num_rows($result) > 0) {
// Existen libros, los muestro
?>
<form name="form1" method="post" action="">
<table width="49%" border="1" align="center">
<tr>
<td><div align="center"><strong>TITULO</strong></div></td>
<td><div align="center"><strong>PRECIO</strong></div></td>
</tr>
<?
while ($reg=mysql_fetch_array($result)) {
echo "<tr>";
echo"<td>".$reg["titulo"]."</td>";
echo "<td>".$reg["precio"]."</td>";
echo"</tr>";
}
}
?>
******fin_ing_libro.php******
<?
$titulo=$_POST['titulo'];
$precio=$_POST['precio'];
$link = mysql_connect("pc20","");
mysql_select_db("biblioteca", $link);
$sql="INSERT INTO libros(titulo,precio)";
$sql.="VALUES('$titulo','$precio')";
$result=mysql_query($sql);
?>
<html>
<head>
<title>Ingreso de Datos</title>
</head>
<body>
<p> </p>
<p align="center"><strong>Datos Ingresados!</strong></p>
<p align="center"><strong><a href="ing_libro.php">Regresar al Menu</a></strong></p>
</body>
</html>
Valora esta pregunta


0