Jump to content

for() Error;


xyn

Recommended Posts

Hi,
from my earlier post, i decided to use a for() loop
to do the work for me, but i get this error;
[color=red]Parse error: syntax error, unexpected T_VARIABLE in /public_html/habbix/dPanel/timetable.php on line 48[/color]

my code: line 48 = [color=red]red[/color]
<?php
            for($i=1;$i<24;$i++){
            [color=red]$query_$i = mysql_query("SELECT * FROM timetable WHERE day='".strtolower($date)."' AND slot_$i='y'");[/color]
            if(mysql_num_rows($query_$i) >0){ $s_$i="TAKEN"; }else{ $s_4i="UN-TAKEN"; }
            }
           
            echo ('
Link to comment
https://forums.phpfreaks.com/topic/28239-for-error/
Share on other sites

[quote author=xyn link=topic=116045.msg472623#msg472623 date=1164294030]
  [color=red]Parse error: syntax error, unexpected T_VARIABLE in /public_html/habbix/dPanel/timetable.php on line 48[/color]
[/quote]

This error indicates there is a variable not recognized.
Try to put the $i outside the single quotes. Is the $date variable initialized?

[code]
$query_$i = mysql_query("SELECT * FROM timetable WHERE day='".strtolower($date)."' AND slot_" . $i . "='y'");
[/code]
Link to comment
https://forums.phpfreaks.com/topic/28239-for-error/#findComment-129141
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.