i have a mysql database storing 2 enteries. now i have this code below to get the first entery and to display it. now i am trying to display the second entery with it, but not to sure on how do it is. and suggestions/help. so i am getting the first field to display and not the second one with it because i dont know how to pull the second one without copying the code and repeating it and am looking for a easier way to do it.
this is what i am using to get infromation from the spdwlkname field and store it in $swn_array
[code=php]
function get_user_sws($username)
{
//extract from the database all the speedwalksb this user has stored
if (!($conn = db_connect()))
return false;
$result = mysql_query( "select spdwlkname
from spdwlk
where username = '$username'");
if (!$result)
return false;
//create an array of the speedwalks
$swn_array = array();
for ($count = 1; $row = mysql_fetch_row ($result); ++$count)
{
$swn_array[$count] = addslashes($row[0]);
}
return $swn_array;
}
and this is what i am using to display
function display_user_sws($swn_array)
{
//display the table of speedwalks
// set global variable, so we can test later if this is on the page
global $sw_table;
$sw_table = true;
?>
<br />
<form name=sw_table action="delete_sws.php" method=post>
<table width=300 cellpadding=2 cellspacing=0>
<?php
$color = "#cccccc";
echo "<tr bgcolor=$color><td><strong>Speedwalk</strong></ td><td><strong>Path</strong></td>";
if (is_array($swn_array) && count($swn_array)>0)
{
foreach ($swn_array as $swn)
{
if ($color == "#cccccc")
$color = "#ffffff";
else
$color = "#cccccc";
// remember to call htmlspecialchars() when we are displaying user data
echo "<tr bgcolor=$color><td>".$swn."</td>";
echo "</tr>";
}
}
else
echo "<tr><td>No Speedwalks on record</td></tr>";
?>
</table>
</form>
<?php
}