<html>
<head>
<title>busqueda</title>
</head>
<body>
<h1>Busqueda de usuarios</h1>
<form name="form1" method="post" action="bus.php">
<label>Buscar:
<input type="text" name="txtBusqueda" id="txtBusqueda">
</label>
<input type="submit" name="cmdBuscar" id="cmdBuscar" value="IR">
</form>
<table border="1">
<tr>
<td>rut_pac </td>
<td>nombres</td>
<td>ap_pat</td>
<td>ap_mat</td>
<td>direccion</td>
<td>telefono</td>
</tr>
<?php
$conexion = mysql_connect('localhost', 'pablito', 'incubus1622'); // tu usuario y tu clave :)
mysql_select_db('bdatos');
if (isset($_POST['txtBusqueda'])) {
$tabla = mysql_query("SELECT * FROM paciente WHERE paciente.rut_pac AND paciente.rut_pac LIKE '%" . $_POST['txtBusqueda'] . "%' ORDER BY paciente.rut_pac ASC");
} else {
$tabla = mysql_query("SELECT * FROM paciente WHERE paciente.ap_pat paciente.ap_pat LIKE '%" . $_POST['txtBusqueda'] . "%' ORDER BY paciente.rut_pac ASC");
}
while ($registro = mysql_fetch_array($tabla)) {
?>
<tr>
<td height="34"><?php echo $registro['rut_pac']; ?></td>
<td><?php echo $registro['nombres']; ?></td>
<td><?php echo $registro['ap_pat']; ?>
<td><?php echo $registro['ap_mat']; ?></td>
<td><?php echo $registro['direccion']; ?>
<td><?php echo $registro['telefono']; ?></tr>
<?php
}
mysql_free_result($tabla);
mysql_close($conexion);
?>
<table>
<body>
<html>
el codigo funciona me busca los pacientes pero me sale este error en pantalla
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\basededatos\wind\bus.php on line 31
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\basededatos\wind\bus.php on line 42