displaying array values in a table
<p>i want to display values from an array in a table, i tried searching and none of it works, here is the snippet</p>

<pre><code>$host="localhost";
$username="root";
$password="";
$db_name="sampledb";
$tbl_name="tblsched";
$cd1 = date("Y-m-d");
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql = "SELECT * FROM tblteacher WHERE teacherName='$uname'";
$result=mysql_query($sql);
$row = mysql_fetch_assoc($result);

$teacherid  = $row['teacherID'];

function mymainfunc()
{
global $uname;
global $teacherid;
$bgcolor="#ADDFFF";
$tdali="center";
dateto();
datefrom();
$arrayto[] = array();
$arrayfrom[] = array();
$arrayto[] = dateto();
$arrayfrom[] = datefrom();
$x=0;
while($x&lt;count($arrayto[]))
{
echo "&lt;tr&gt;";
echo "&lt;td align=$tdali bgcolor=$bgcolor&gt;$arrayfrom[$x] - $arrayto[$x]&lt;/td&gt;";
echo "&lt;td align=$tdali&gt; &lt;/td&gt;";
echo "&lt;td align=$tdali&gt; &lt;/td&gt;";
echo "&lt;td align=$tdali&gt; &lt;/td&gt;";
echo "&lt;td align=$tdali&gt; &lt;/td&gt;";
echo "&lt;td align=$tdali&gt; &lt;/td&gt;";
echo "&lt;td align=$tdali&gt; &lt;/td&gt;";
echo "&lt;td align=$tdali&gt; &lt;/td&gt;"; 
echo "&lt;/tr&gt;";

$x++;
}
}
function dateto()
{
global $uname;
global $cd1;
global $teacherid;
$sql="SELECT SchedTimeTo FROM tblsched WHERE SchedTeacherID=$teacherid and SchedDateFrom&lt;='$cd1' and SchedDateTo&gt;='$cd1' ";
$result=mysql_query($sql);

if($result === FALSE) {
die(mysql_error());
}

$count=mysql_num_rows($result);
$row = mysql_fetch_array($result);

$STF = array();
while($row=mysql_fetch_array($result))
  {
  $STF[] = $row;
}

return $STF;
}

function datefrom()
{
global $uname;
global $cd1;
global $teacherid;
$sql="SELECT SchedTimeFrom FROM tblsched WHERE SchedTeacherID=$teacherid and SchedDateFrom&lt;='$cd1' and SchedDateTo&gt;='$cd1' ";
$result=mysql_query($sql);

if($result === FALSE) {
die(mysql_error());
}

$row = mysql_fetch_array($result);

$STF = array();
while($row=mysql_fetch_array($result))
  {
  $STF[] = $row;
  }

return $STF;
}
</code></pre>

<p>any suggestion on how can i display each array value in a different cell, every cell will contain different values from the array </p>
