总喜欢的人数

编程入门 行业动态 更新时间:2024-10-26 16:34:42
本文介绍了总喜欢的人数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想写一下喜欢的总数,但我不知道怎么能让这个来检索表的内容

Hi, I would like to write, the total number of likes, but I don't know how I can make this to retrieve the contents of the table

<?php try { $user = 'root'; $pass = ''; $PDO = new PDO('mysql:host=localhost;dbname=mike', $user, $pass); $PDO->exec("set names utf8"); $query = "SELECT SUM(likes) as test FROM news WHERE autor=".$_SESSION['id'].""; $c_query = $PDO->prepare($query; $c_query->execute(); $results = $c_query->fetch(PDO::FETCH_ASSOC); if($results) { echo "Total number of likes: ".$f_test = $results['test']; } } catch(PDOException $e) { echo "Error: " .$e; } ?>

我的尝试: with COUNT()并使用多个查询

What I have tried: with COUNT() and use multiple query

推荐答案

user = ' root'; user = 'root';

pass = ' ' ; pass = '';

PDO = new PDO(' mysql:host = localhost; dbname = mike', PDO = new PDO('mysql:host=localhost;dbname=mike',

更多推荐

总喜欢的人数

本文发布于:2023-11-29 19:21:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647387.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:人数   喜欢

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!