The query not work

wxdqz

New Member
Hello All
I have Win98, Apache 1.3.9, PHP 4.0.5 and MySQL 3.23.38. I am trying to run this:

<?php

// create connection
$connection = mysql_connect("localhost","alonsod","18021965");

// test connection
if (!$connection) {
echo "Couldn't make a connection!";
exit;
}

// select database
$db = mysql_select_db("datos", $connection);

// test selection
if (!$db) {
echo "Couldn't select database!";
exit;
}

// create SQL statement
$sql = "SELECT * FROM clientes";

// execute SQL query and get result
$sql_result = mysql_query($sql,$connection);

// start results formatting
echo "<TABLE BORDER=1>";
echo "<TR><TH>DNI</TH>
<TH>NOMBRE</TH>
<TH>TELEFONO</TH></TR>";

// format results by row
while ($row = mysql_fetch_array($sql_result))
{
$dni = $row["DNI"];
$nombre = $row["NOMBRE"];
$telefono = $row["TELEFONO"];
echo "<TR><TD>$dni</TD>
<TD>$nombre</TD>
<TD>$telefono</TD></TR>";
}

echo "</TABLE>";

// free resources and close connection
mysql_free_result($sql_result);
mysql_close($connection);
?>

PHP work fine but not data are showed and the database is not empty. The path for my database is C:\MYSQL\data. I have tryed to use diferents values for Hostname in
mysql_connect() but I have errors in conection. Any Idea?
 
Back
Top