dsiuy42084 2016-11-11 05:10
浏览 25

PHP PDO MySql查询结果未更新

hopefully I can explain this clearly enough.

On my profile page (let's call it profile.php), I am including a header file (header.php) that contains all the HTML header code and menu, as well as some queries to show stats to a user (how many surveys they have completed, and rewards earned). There are multiple queries on this page, but all work as expected, such as

header.php

<h3>              
 <?php
  $whereCnt = array(
    array('svy_end_status','=',1),
    array('svy_end_mem_id','=',$member_id)
  );

  $svycnt = DB::getInstance()->get( 'COUNT(*) AS Count', 'survey_end', $whereCnt );

  echo $svycnt->first()->Count;
 ?>    
</h3>

Back in profile.php I have another query to get all the user profile information:

$wheremem = array(
    array( 'member-uid', '=', $member_id ));

$completeprofileqry = DB::getInstance()->get('*','members',$wheremem);

NOTE: This is using a DB class based from Codecourse's Login/Register tutorial but is using PDO as the method.

Now, when I do a

if ($completeprofileqry->count()){
    echo '<pre>';
    print_r($completeprofileqry->first());
    echo '</pre>';

I get as the output:

stdClass Object
(
    [Count] => 2
)

This output directly correlates with the first query from the included header file, rather than the new query.

Is this due to the 'instance' still being the same?

I should also note, that on my index.php page, I am doing other queries, as well as using the same included header.php, but I am having NO issues with these query results.

Can anyone help narrow down where the problem might be?

EDIT: I am an idiot

It was meant to be 'member_uid' NOT 'member-uid' (underscore not hyphen !!!)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 mmocr的训练错误,结果全为0
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀