【发布时间】:2014-10-08 07:46:52
【问题描述】:
我已经在国内外抛出了 4 个多小时的大量线程,并且似乎遗漏了一件简单的事情。
我正在尝试让几个用户将他们的“新闻”上传到 MYSQL。
然而,我只想显示带有登录用户名(userpost)的“新闻”附加到该行。
$current 是登录用户的用户名,有效。
示例 A 没有过滤掉不包含 $current 用户的行。
示例 B 未提供任何输出
所以我两个都试过了:
$result = mysqli_query($con,"SELECT * FROM images_tbl");
//echo $current . "2" . $current;
while($row = mysqli_fetch_array($result)) {
if ($row['userpost'] = '.$current.') {
$num = 0;
$num = $num + 1;
$pic.$num = $row['images_path'];
$h1 = $row['hlone'];
和乙:
$result = mysqli_query($con,"SELECT * FROM images_tbl WHERE (userpost = '.$current.')");
echo $current . "2" . $current;
while($row = mysqli_fetch_array($result)) {
echo $row['hlone'] . " " . $row['images_path'];
echo "<img src=\"" .$row['images_path']. "\">";
}
27, images/08-10-2014-1412752801.jpg(images_path), 2014-10-08, Headline(hlone), Headline2, story, testb(userpost)
任何帮助将不胜感激。
【问题讨论】:
-
显示你的数据库模型
标签: php mysql variables select where