(!)解析错误:语法错误,第29行C:\ wamp \ www \ corporation \ new_subject.php中的意外'for'(T_FOR)

时间:2015-07-28 06:17:32

标签: php

我收到错误的for循环和错误名称我把它放在问题标题上请帮帮我...

<p>POSITION 
    <select name="postion">
        <?php
            $all_subj =  get_all_subjects();
            $subj_count     = mysql_num_rows($all_subj);

            for($count=1; $count < = $subj_count+1; $count++){
                echo " <option value='$count'>{$count}</option>" ;  
            }
        ?>
    </select>
</p>

2 个答案:

答案 0 :(得分:2)

只需删除<=之间的空格,如下所示: -

for($count=1; $count <= $subj_count+1; $count++){

答案 1 :(得分:1)

<=应该在for循环

<p>POSITION <select name="postion" > <?php $all_subj = get_all_subjects(); $subj_count = mysql_num_rows($all_subj); for($count=1; $count <= $subj_count+1; $count++) { echo " <option value='$count'>{$count}</option>" ; } ?> </select> </p>
declare @date Datetime ='',@query nvarchar(max),@parms nvarchar(max);
set @date   =getdate();
set @query=N'select * from [3].[Sync_Database_BTS].dbo.[Test]
             where [Test] >=cast(date,@date) ; ';
set @parms = N'@date datetime';

exec sp_executesql @query,@parms,@date