A
Anonymous
Guest
i'm having trouble showing all the information that im pulling from mysql database with this array. this is a lot of code but i hope you can follow it. I want to show First Name and Last Name, and URL, but the array only shows the FIRST name and not both
Code:
// this is the first function
function get_user_urls($username)
{
//extract from the database all the URLs this user has stored
if (!($conn = dbconnect()))
return false;
$result = mysql_query( "select usrfname, usrlname, usrurls
from usrinfo
where username = '$username'");
if (!$result)
return false;
//create an array of the URLs
$url_array = array();
for ($count = 1; $row = mysql_fetch_row ($result); ++$count)
{
$url_array[$count] = addslashes($row[0]);
}
return $url_array;
}
Code:
function display_user_urls($url_array)
{
//display the table of URLs
?>
<br />
<form name=bm_table action="delete_bms.php" method=post>
<table width=300 cellpadding=2 cellspacing=0>
<?php
$color = "#cccccc";
echo "<tr bgcolor=$color><td><strong>Bookmark</strong></td>";
echo "<td><strong>Delete?</strong></td></tr>";
if (is_array($url_array) && count($url_array)>0)
{
foreach ($url_array as $url)
{
if ($color == "#cccccc")
$color = "#ffffff";
else
$color = "#cccccc";
echo "<tr bgcolor=$color><td><a href=\"$url\">".htmlspecialchars($url)."</a></td>";
// ------ the $url only displays FIRST NAME
echo "<td><input type=checkbox name=\"del_me[]\"
value=\"$url\"></td>";
echo "</tr>";
}
}
else
echo "<tr><td>No bookmarks on record</td></tr>";
?>
</table>
</form>
<?php
}
Code:
// these functions are linked together with this script
if ($url_array = get_user_urls($HTTP_SESSION_VARS['valid_username']));
display_user_urls($url_array);