I have this code <? $strSQL5 = "SELECT distinct Training_Date from trainingattendance WHERE Training_Date between '".date('Y-4-')."01' and '".date('Y-m-')."31'"; $Conn=mysql_connect("localhost","***","***"); mysql_select_db("***",$Conn); $result5 = mysql_query($strSQL5); ?> <? while($row5 = mysql_fetch_assoc($result5)){ someArray[i] = $row5['Training_Date']; i++; } ?> Code (markup): the array make the page crash? why? If i change the someArray[i] = $row5['Training_Date']; i++; Code (markup): to print $row5['Training_Date']; Code (markup): it works... but i need to save in an array...
<?php $strSQL5 = "SELECT distinct Training_Date from trainingattendance WHERE Training_Date between '".date('Y-4-')."01' and '".date('Y-m-')."31'"; $Conn=mysql_connect("localhost","***","***"); mysql_select_db("***",$Conn); $result5 = mysql_query($strSQL5); while($row5 = mysql_fetch_assoc($result5)){ $someArray[] = $row5['Training_Date']; } ?> PHP:
thanks.. how do I then return the length of the array.. i want to do something like.. while (i <= less than my last array?? ){ print $someArray i++; }
If anyone know how to use curl to fetch page content from authanticate url please guide me. It's urgent.
All variables in PHP must start with $. You can use the count() function to get the number of values in the array and a for() loop to go through them. $lastArray = count($oldArray); for ( $i = 0 ; $i < $lastArray; $i++ ) { print $newArray[$i]; } PHP: