hice un archivo de conectar.php
Código :
<? $conexion = mysql_connect ("localhost", "usuario", "pasword"); mysql_select_db("basededatos", $conexion); ?>
y mi archivo.php quedo asi
Código :
<?php include("conectar.php"); $nombre = $_POST['nombre']; $clave = $_POST['clave']; $strqry = "SELECT * FROM clientes where nombre =\"".$nombre."\" and clave =\"".$clave."\""; $qry = mysql_query($strqry); $row = mysql_fetch_assoc($qry); if ($row ["nombre"]=="") { print '<p> "Nombre Incorrecto"</font></p>'; } else { session_start(); $_SESSION["nombre"]=$nombre; $_SESSION["clave"]=$clave; ?> <p>BIENVENIDO</font></b></p> <table> <tr> <td>NUMERO</td> <td>FECHA DE ALTA</td> <td>FECHA</td> <td>HORA DE ALTA</td> </tr> <?php $strqry = "SELECT * FROM tabladatos where numero =\"".$num."\""; $qry = mysql_query($strqry); while ($row = mysql_fetch_assoc($qry)){ ?> <tr> <td><?php print $row ["numero"]; ?></td> <td><?php print $row ["fecha_alta"]; ?></td> <td><?php print $row ["fecha"]; ?></td> <td><?php print $row ["hora_alta"]; ?></td> </tr> <?php } } ?> </body> </html>
pero no me da la informacion, me da este error
Código :
Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\archivo.php on line 9 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\archivo.php on line 9 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\archivo.php on line 10
pero si comento el include y hago la conexion en el mismo archivo, parece que si funciona pero no me da la informacion de la base de datos pero me pone este mensaje
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0