I've written up a page that tries to search my Oracle database. I can't see where I've gone wrong. I can't get any result to display, despite changing my query to "SELECT * FROM Table WHERE Book_Name="..." (Guaranteed to return a result).
$query = "SELECT * FROM Books WHERE Book_Name = 'My Life'";
$dbuser = "username...";
$dbpass = "password...";
$db = "SSID";
$connect = oci_connect($dbuser, $dbpass, $db);
if (!$connect) {
echo "An error occurred connecting to the database";
exit;
}
$stmt = oci_parse($connect, $query);
if(!$stmt) {
echo "An error occurred in parsing the sql string.
";
exit;
}
oci_execute($stmt);
?>
some html...
<?php
while(oci_fetch_array($stmt)) {
$fg1 = oci_result($stmt,"BOOK_NAME");
echo ($fg1);
$fg2 = oci_result($stmt,"AUTHOR");
echo ($fg2);
$fg3 = oci_result($stmt,"PRICE");
echo ($fg3);
$fg4 = oci_result($stmt,"IMAGE_LOCATION");
echo ("<br><img src=My Url...".$fg4."><br>");
}
?>
I've made sure the Oracle table is correct also. Thanks for your help.
Update: It appears anything between the while(oci_fetch_array($stmt)) {
part will not execute.