English 中文(简体)
RowCount() = 0误差 php mysql
原标题:RowCount() = 0 error php mysql
echo "<h2 style= margin:0; padding:0; >Recent Comments</h2>";

            if ($sth7->rowCount()) {
                while($row7 = $sth7->fetch(PDO::FETCH_ASSOC)) {
                echo "<div class= comment >{$row7[ usr ]} said";
                }
            }
            else($sth7->rowCount() = 0)                                                          
            echo "User";

Can t use method return value in write context

为什么会把这个词推到零逻辑工作?

问题回答

= PHP的转让经营人。

您基本上试图分配0至7美元,“增长”

或许,你指的是第7->美元;rowCount()= 0?

而且,如果是的话,你确实不需要。 也许只是这样:

if($sth7->rowCount()) {

} else {

}

输电管会(rowCount)()回收了一种愤怒,除0外,任何愤怒都会变成现实。

Try rowcount() = 0,相比之下,你的代码(rowcount() = 0)试图转让。 0. 此外,在比较(0 = = rowcount(<>)时,对左边作常态可能是有益的,以便更容易发现这些错误。

如果(和任何其他人)没有评价真实情况的话,它就行了。

此外,=为转让操作者,将其改为“becoms Equal to”

$var = 1; // Var becomes equal to 1

= 是平等操作者,如果两个表述形式平等,则测试。

$var == 1 // Var is equal to 1

你们可能希望

else if ($sth7->rowCount() == 0)                                                          
     echo "User";




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签