Php 在Oracle数据库中指定和打印列
我在指定希望输出的数据时遇到问题,我尝试的是打印配方表中包含的所有配方标题Php 在Oracle数据库中指定和打印列,php,sql,oracle,Php,Sql,Oracle,我在指定希望输出的数据时遇到问题,我尝试的是打印配方表中包含的所有配方标题 $stid2 = oci_parse($conn, 'select recipetitle from recipes.recipe'); oci_execute($stid2); while ($row = oci_fetch_array($stid2, OCI_ASSOC)) { echo "<p>Sorry, there are no titles</p>"; } else {
$stid2 = oci_parse($conn, 'select recipetitle from recipes.recipe');
oci_execute($stid2);
while ($row = oci_fetch_array($stid2, OCI_ASSOC)) {
echo "<p>Sorry, there are no titles</p>";
} else {
echo '<p> <b>Recipe Title: </b>' . $row['recipetitle'] . '</p>';
}
}
$stid2=oci_parse($conn,“从recipes.recipe中选择RecipeTle”);
保监处执行(stid2美元);
而($row=oci\u fetch\u数组($stid2,oci\u ASSOC)){
echo“对不起,没有标题”;
}否则{
回显“配方标题:”.$row['recipetitle']。”;
}
}
这可能吗?我刚得到“未识别索引”错误
谢谢正如我所评论的,
而
/其他
在php中不存在
相反,请尝试:
$stid2 = oci_parse($conn, 'SELECT `recipetitle` FROM `recipes`.`recipe`');
oci_execute($stid2);
//Output var
$output = '';
while ($row = oci_fetch_array($stid2, OCI_ASSOC)) {
$output .= '<p> <b>Recipe Title: </b>' . $row['recipetitle'] . '</p><br>';
}
//Ternary test
$output == '' ? echo "<p>Sorry, there are no titles</p>" : echo $output;
$stid2=oci_parse($conn,'SELECT'recipetitle`来自'recipes`.'recipe`');
保监处执行(stid2美元);
//输出变量
$output='';
而($row=oci\u fetch\u数组($stid2,oci\u ASSOC)){
$output.='配方标题:'.$row['recipetitle'].
';
}
//三元试验
$output=''?echo“对不起,没有标题:”:echo$output;
而
/其他
在php中不存在。