echo'
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html">HOME</a></li>
<li><a href="itsupport.html">TEAM</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">SERVICES <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="itservices.html">IT SERVICES</a></li>
<li><a href="voiceservices.html">VOICE SERVICES</a></li>
</li>
</ul>
</li>
<li><a href="careers.html">CAREERS</a></li>
<li><a href="careers.html">INTERESTING INFORMATION</a></li>
<li><a href="contact.html">CONTACT</a></li>
</ul>';
我在mysql DB中有表作者和发布者。他们都有ISBN 专栏。然后我发出一个调用(通过php)到存储过程 它包含以下代码:
if(!$this->MakeProcedure("StupidProcedure", "OUT msg VARCHAR(25)" )){
echo "could not create procedure";
}
if(!$this->db->query("SET @msg = ''") || !$this->db->query("CALL StupidProcedure(@msg)")){
echo "CALL to StupidProcedure failed:";
} else {
$res= $this->db->query("SELECT @msg as _p_out");
$row = $res->fetch();
echo $row['_p_out']." counted columns ";
}
基本上,我希望上面的代码段返回2作为计数表的数量 有共同的ISBN列(反映在计数变量中)。不幸, 尽管多次检查,但是计数总是返回0 - 检查ISBN列是什么 那里(用phpmyadmin)。为什么count(*)表现得很奇怪?或者在那里 我必须设置一个特殊的.ini配置吗?
这是我的测试驱动程序:
非常感谢任何帮助。
答案 0 :(得分:0)
哇!终于我明白了。这是执行脏修复的sql代码片段:
BEGIN
DECLARE count int;
SELECT count(1)
FROM information_schema.columns
WHERE table_name IN ('authors', 'publishers')
AND column_name = 'ISBN'
AND table_schema = 'test'
INTO count;
SELECT count INTO msg; /*just to debug counter*/
END
//PRINT ‘Thank you guys !’
&#13;