Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my code below working well in apache server but when in wamp server giving ERROR....
Use of Undefined constant i -assumed 'i' in chstat.php on line 16..

please help me out where I am worng..

What I have tried:

$chnos = 28;
include 'dbcon.php';

$sql = mysql_query("SELECT active FROM channel_des ;") or die("Query to show fields from table failed");

$chstatus = array();

while($row = mysql_fetch_array($sql)){
    array_push($chstatus, $row['active']);
   
}

for($i=0; $i <= $chnos; $i++){
	echo $chstatus[i];
}
Posted
Updated 29-Mar-17 9:28am
Comments
ramen79 29-Mar-17 15:43pm    
I have re-write echo $chstatus[$i];... now it is showing the array output, but showing Notice: Undefine offset:28 in chstat.php...
ramen79 29-Mar-17 16:00pm    
I have solved the problem..
re-written <=count($chnos).....

thanks...

1 solution

try renaming 'i' to something else in your loop..Could be a conflict with something else.
 
Share this answer
 
Comments
ramen79 29-Mar-17 15:59pm    
I have solved the problem..
re-write <= count($chnos) ..

thanks...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900