无法回显该值

发布于 2024-11-07 01:26:06 字数 344 浏览 3 评论 0原文

我只是尝试从 mysql 数据库检索一个值,并尝试使用 php 函数打印该值。但这不起作用:(请帮忙。

<?php
include("connection.php");
$con=mysql_query("SELECT times FROM counts WHERE item='applemenu';");
$info = mysql_fetch_array($con);
$count==$info['times'];
?>

在一些 html 标签之后

<?php echo $count;?>

有什么问题吗?

I just tried to retrieve a value from my mysql databade and tried to print that using php function. But this is not working :( Please help.

<?php
include("connection.php");
$con=mysql_query("SELECT times FROM counts WHERE item='applemenu';");
$info = mysql_fetch_array($con);
$count==$info['times'];
?>

after some html tags

<?php echo $count;?>

Is there anything wrong ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小耗子 2024-11-14 01:26:06
$count==$info['times'];

将此更改为

$count=$info['times'];
$count==$info['times'];

change this to

$count=$info['times'];
救赎№ 2024-11-14 01:26:06
<?php
 include("connection.php");
 $input = 'applemenu';
 $stmt = mysqli_prepare($con,"SELECT times FROM counts WHERE item=?");
 mysqli_stmt_bind_param($stmt,"s",$input);
 mysqli_stmt_execute($stmt);
 mysqli_stmt_bind_result($stmt, $count);
 mysqli_stmt_fetch($stmt);
 mysqli_stmt_close($stmt);
 mysqli_close($con);

 echo $count;
?>
<?php
 include("connection.php");
 $input = 'applemenu';
 $stmt = mysqli_prepare($con,"SELECT times FROM counts WHERE item=?");
 mysqli_stmt_bind_param($stmt,"s",$input);
 mysqli_stmt_execute($stmt);
 mysqli_stmt_bind_result($stmt, $count);
 mysqli_stmt_fetch($stmt);
 mysqli_stmt_close($stmt);
 mysqli_close($con);

 echo $count;
?>
棒棒糖 2024-11-14 01:26:06
<?php
include("connection.php");
$con=mysql_query("SELECT times FROM counts WHERE item='applemenu';");
$info = mysql_fetch_array($con);
$count= $info['times'];// This was the wrong with == operator
?>

在一些 html 标签之后

<?php echo '$count';?>
<?php
include("connection.php");
$con=mysql_query("SELECT times FROM counts WHERE item='applemenu';");
$info = mysql_fetch_array($con);
$count= $info['times'];// This was the wrong with == operator
?>

after some html tags

<?php echo '$count';?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文