I used phpMyAdmin - 2.10.1 on the server as follows:
1) created a database named Library
2) created a table named Books
3) created fields named INV#, TITLE, AUTHOR
4) imported records
5) formulated and ran a successful query (using phpMyAdmin)
6) used "Create PHP Code" to generate $sql
7) inserted $sql at line 14. (below):
Code: Select all
<html>
<head><title>Test6.php</title></head>
<body>
<?php
error_reporting(E_ALL);
define("HOST","localhost");
define("USER","userxxx");
define("PASS","passyyy");
define("DB","Library");
$cxn = mysql_connect(HOST, USER, PASS, DB)
or die("Cannot connect to MySQL.<br>" . mysql_error());
echo "Successful connect: " . $cxn . "<br>";
$sql = 'SELECT * FROM `Books` LIMIT 0, 30 ';
echo "Submitting: " . $sql . "<br>";
$result = mysql_query($cxn, $sql)
or die("Cannot select.<br>" . mysql_error());
echo "Successful select." . $result . "<br>";
?>
</body>
</html>
It appears I am able to successfully connect, but that the select is failing. If someone could explain what am I doing incorrectly, it would be surely improve my Father's Day. Please enunciate clearly, as I'm a 67 year old PHP/MySQL novice who is somewhat hearing impaired.Successful connect: Resource id #2
Submitting: SELECT * FROM `Books` LIMIT 0, 30
Cannot select.
Thanks,
Roger