Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 什么?建议你查找连接实际上,我相信连接并不总是更快。@Lawrence Cherone,我已经考虑过这个问题,并对连接做了“少量”的研究,我只是不确定我是否非常了解它们,但我将进一步研究它。谢谢当然,现在我正试图找到解决这个问题的方法,但我真的会更多地研究_Php_Sql - Fatal编程技术网

Php 什么?建议你查找连接实际上,我相信连接并不总是更快。@Lawrence Cherone,我已经考虑过这个问题,并对连接做了“少量”的研究,我只是不确定我是否非常了解它们,但我将进一步研究它。谢谢当然,现在我正试图找到解决这个问题的方法,但我真的会更多地研究

Php 什么?建议你查找连接实际上,我相信连接并不总是更快。@Lawrence Cherone,我已经考虑过这个问题,并对连接做了“少量”的研究,我只是不确定我是否非常了解它们,但我将进一步研究它。谢谢当然,现在我正试图找到解决这个问题的方法,但我真的会更多地研究,php,sql,Php,Sql,什么?建议你查找连接实际上,我相信连接并不总是更快。@Lawrence Cherone,我已经考虑过这个问题,并对连接做了“少量”的研究,我只是不确定我是否非常了解它们,但我将进一步研究它。谢谢当然,现在我正试图找到解决这个问题的方法,但我真的会更多地研究如何使用联接。@stefgosselin你认为不对,有了适当的索引,5个查询可以和1个查询一样快,在3层的每次迭代中查询数据库,而当只得到第一个n个姓时,循环是可怕的,很高兴知道!就像我说的,我在这方面是新手…它们不在示例中,但我的所有变量都在


什么?建议你查找连接实际上,我相信连接并不总是更快。@Lawrence Cherone,我已经考虑过这个问题,并对连接做了“少量”的研究,我只是不确定我是否非常了解它们,但我将进一步研究它。谢谢当然,现在我正试图找到解决这个问题的方法,但我真的会更多地研究如何使用联接。@stefgosselin你认为不对,有了适当的索引,5个查询可以和1个查询一样快,在3层的每次迭代中查询数据库,而当只得到第一个n个姓时,循环是可怕的,很高兴知道!就像我说的,我在这方面是新手…它们不在示例中,但我的所有变量都在页面顶部初始化,我只是重复检查以确保。还有其他想法吗?是的。调试代码,在其中插入一些var_dump(),或者echo和print_r,如果您想要更漂亮的消息,请使用krumo()。使用内置调试器ie的ide:php编辑、zend ide、kommodo。。。或者只是apache中的老xdebug客户端。我仍然坚持做这件事,其他任何事情。通过在那里的一些转储,一切看起来都正常,除了当一个blab和它的注释被调用时,它的所有注释以及之前的blab中的注释也被调用。
// ------- MEMBER BLABS OUTPUT CONSTRUCTION ---------

$sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date, blab_type, device, fromid FROM blabbing WHERE mem_id='$id' ORDER BY blab_date DESC LIMIT 30");

while($row = mysql_fetch_array($sql_blabs)){

    $blabid = $row["id"];
    $fromid = $row["fromid"];
    $blab_device = $row["device"];

        $sql_comments = mysql_query("SELECT * FROM blab_comments WHERE blab_id='$blabid' ORDER BY id ASC");
        $count_comment = mysql_num_rows($sql_comments);
        if($count_comment > 0){
        while($row2=mysql_fetch_array($sql_comments)){
            $comment_mem_id = $row2['mem_id'];
            $com_blab_id = $row2['blab_id'];
            $comment_txt = $row2['the_comment'];
            $comment_date = $row2['comment_date'];
            $convertedTime = ($myObject -> convert_datetime($comment_date));
            $whenComment = ($myObject -> makeAgo($convertedTime));
            $sql_comment_user = mysql_query("SELECT firstname, lastname FROM myMembers WHERE id='$comment_mem_id' LIMIT 1");
            while($row3 = mysql_fetch_array($sql_comment_user)){
            $firstname = $row3['firstname']; 
            $lastname = $row3['lastname']; 
            $comment_user = $firstname.' '.$lastname;
            }
            $comment_pic = check_pic("members", $comment_mem_id, "40", "profile");
            ///////  Mechanism to Display Real Name Next to Username - real name(username) //////////////////////////
            $DisplayCommentList .='
                <div style="background-color:#e3eaf3; width:auto; height:auto; word-wrap: break-word;">
                <div style="margin-right:10px; margin:8px; width:40px; height:40px; overflow:hidden; display:inline-block;">'.$comment_pic.'</div>
                <div style="float:right; width:390px; margin-bottom:8px; margin-top:3px;">
                    <span class="liteGreyColor textsize9" style="width:auto;">'.$whenComment.' 
                        <a href="profile.php?id=' . $fromid . '"><strong>'.$comment_user.'</strong></a> said via <em>'.$blab_device.'</em>
                    </span><br />'.$comment_txt.'<br />
                </div>
            </div>
            <hr style="margin:0px; clear:both; margin-left:8px;" />';
        }
        }else{
            $DisplayCommentList = "";
        }

    $uid = $row["mem_id"];
    $the_blab = $row["the_blab"];
    $the_blab = ($activeLinkObject -> makeActiveLink($the_blab));
    $blab_date = $row["blab_date"];
    $convertedTime = ($myObject -> convert_datetime($blab_date));
    $whenBlab = ($myObject -> makeAgo($convertedTime));
    $blab_date = $row["blab_date"];
    $blab_type = $row["blab_type"];
    $blab_pic = check_pic("members", $fromid, "60", "profile");
       //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        $usersql = mysql_query("SELECT firstname, lastname FROM myMembers WHERE id='$fromid' LIMIT 1");
        while($row = mysql_fetch_assoc($usersql)){
            $fromuser = $row["firstname"];
            $fromuserLast = $row["lastname"];
            $fromusername = $fromuser . ' ' . $fromuserLast;
            if(isset($_SESSION['idx'])){

                $blabberDisplayList .= '
                    <table style="background-image:url(images/white_title.png); color:#333; border:#F0F0F0 1px solid; border-top: 0px; padding-bottom:10px;" cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                        <td width="18%" valign="top"><div id="blab_pic" style="overflow:hidden; width:60px; margin:10px 0px 10px 10px;">' . $blab_pic . '</div></td>
                        <td width="82%" valign="top" style="line-height:1.5em; padding-top:7px;">
                        <span id="myTable" class="liteGreyColor textsize9">' . $whenBlab . ' <a href="profile.php?id=' . $fromid . '"><strong>' . $fromusername . '</strong></a> said via <em>' . $blab_device . '</em></span><br />
                         ' . $the_blab . '
                        </td>
                        </tr>
                        <tr>
                        <td width="18%" valign="top"></td>
                        <td width="82%" style="line-height:1.5em; padding-right:15px; background-color:#e3eaf3;" valign="top">
                        '.$DisplayCommentList.'
                        <div id="new_comment'.$blabid.'" style="display:none;">

                        </div>
                        <textarea id="Comment'.$blabid.'" style="width:99%; margin-top:8px; margin-left:8px;" rows="1"></textarea><br />
                        <input style="color:#666; float:right; background-color:transparent; border:0px; margin-left:8px; margin-right:8px;" type="submit" value="comment" onclick="javascript:SendComment(\''.$blabid.'\');" />
                        </td>
                        </tr></table>';

}}}
// ------- END MEMBER BLABS OUTPUT CONSTRUCTION ---------