Hi,
I try an SQL query in phpMyAdmin and it works okay. I am also given a
connection string in PHP as well. When I try to combine these into a
.PHP page to query the database it doesn't work. No error. Nothing.
I am obviously doing something wrong but I don't know what. My
database and table have the same name but I hope that doesn't matter.
Apart from changing my password/username below, this is what I tried ;
<html>
<body>
<?php
$dbh=mysql_connect ("localhost", "jf_USER", "password") or die ('I
cannot connect to the database because: ' . mysql_error());
mysql_select_db ("jf_invcomma");
$sql = 'SELECT '
. ' `invcomma`.`ISBN`,'
. ' `invcomma`.`TITLE`,'
. ' `invcomma`.`AUTHOR`,'
. ' `invcomma`.`PRICE`,'
. ' `invcomma`.`CAT`'
. ' FROM'
. ' `invcomma`'
. ' WHERE'
. ' `invcomma`.`AUTHOR` = "Hall Judy" '
. ' ORDER BY'
. ' `invcomma`.`ISBN`,'
. ' `invcomma`.`TITLE`,'
. ' `invcomma`.`AUTHOR`,'
. ' `invcomma`.`PRICE`,'
. ' `invcomma`.`CAT` LIMIT 0, 30';
?>
</body>
Can anyone tell me what I have done wrong and/or the correct code to
make things work please ?
Regards, John.