Location: PHPKode > projects > PHP MySQL Address Book > addressbook/dtaildaddresscard.php
<?php
require("sesionchk.php");
?>
<html>
<head>
<title>
<?php
require("title.php");
?>
</title>
<!--<link rel="stylesheet" type="text/css" href="styles/wide_screen.css">-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>


<?php
require("links.php");
include 'library/config.php';
include 'library/opendb.php';
/*
// how many rows to show per page
$rowsPerPage = 20;

// by default we show first page
$pageNum = 1;

// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
	$pageNum = $_GET['page'];
}

// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
*/
//$query  = "SELECT FirstName,EmailAddress,ID FROM contacts LIMIT $offset, $rowsPerPage";
if ($_GET[value]=="all")
{
$query  = "SELECT  `Title`, `FirstName` , `JobTitle` , `Company` , `BusinessStreet` , `HomeStreet` , `OtherStreet` , `BusinessPhone` , `BusinessPhone2` , `HomePhone` , `HomePhone2` , `MobilePhone` , `BusinessFax` , `EmailAddress` , `Email2Address` , `Email3Address` , `WebPage` , `Categories` , `Notes`,ID,user_id FROM contacts ORDER BY FirstName  ASC";
}
else
{
$query  = "SELECT  `Title`, `FirstName` , `JobTitle` , `Company` , `BusinessStreet` , `HomeStreet` , `OtherStreet` , `BusinessPhone` , `BusinessPhone2` , `HomePhone` , `HomePhone2` , `MobilePhone` , `BusinessFax` , `EmailAddress` , `Email2Address` , `Email3Address` , `WebPage` , `Categories` , `Notes`,ID,user_id FROM contacts where FirstName like '".$_GET[value]."%' ORDER BY FirstName  ASC";
}
mysql_query("SET NAMES 'utf8'");
mysql_query('SET CHARACTER SET utf8'); 
$result = mysql_query($query) or die('Error, query failed');
?>

<?php  
foreach (range('A', 'Z') as $letter) {
	print" <a href=\"".$_SERVER['PHP_SELF']."?type=sort&value=".$letter."\" class=\"text\">".$letter."</A>  ";
} 
print" <a href=\"".$_SERVER['PHP_SELF']."?type=sort&value=all\" class=\"text\">All</A> ";
?>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
    <td style=" vertical-align: top;">
	</td>
    <td>
	<?php
echo "<table width=500 border='1' cellpadding='1' cellspacing='1' bordercolor='#000000'> <COLGROUP span='10' width='0*'>";
echo "<tr><td><h2>Contacts</h2></td></tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
	echo "<td>";
	if ($_SESSION['usr_level'] <>3 or $_SESSION['usr_id']==$row['user_id'])
	{
	echo "<a href=\"wabraaddressbook.php?ID=".$row['ID']."\">Edit</a>";
	}
	else
	{
	echo "<a href=\"wabraaddressbook.php?ID=".$row['ID']."\">View</a>";
	}
	echo "</td>";
	echo "<td>";
	if (trim($row['FirstName'])!=="")
	{
	echo "<b>".$row['FirstName']."</b><br>";
	if (trim($row['Title'])!=="")
	{
	echo "Full Name:&nbsp;&nbsp;".trim($row['Title'])." " .trim($row['FirstName'])."<br>";
	}
	else
	{
	echo "Full Name:&nbsp;&nbsp;".trim($row['FirstName'])."<br>";
	}
	}
	
	
	if (trim($row['JobTitle'])!=="")
	{
	echo "Job Title:&nbsp;&nbsp;".trim($row['JobTitle'])."<br>";
	}
	
	
	if (trim($row['Company'])!=="")
	{
	echo "Company:&nbsp;&nbsp;".trim($row['Company'])."<br>";
	}
	
	//echo "</td>";
	//echo "<td>";
	if (trim($row['BusinessStreet'])!=="")
	{
	echo "Business:&nbsp;&nbsp;".$row['BusinessStreet']."<br>";
	}
		if (trim($row['HomeStreet'])!=="")
	{
	echo "Home:&nbsp;&nbsp;".$row['HomeStreet']."<br>";
	}
		if (trim($row['OtherStreet'])!=="")
	{
	echo "Other:&nbsp;&nbsp;".$row['OtherStreet']."<br>";
	}
	
	if (trim($row['BusinessPhone'])!=="")
	{
	echo "Business:&nbsp;&nbsp;".$row['BusinessPhone']."<br>";
	}
		if (trim($row['BusinessPhone2'])!=="")
	{
	echo "Business 2: 2&nbsp;&nbsp;".$row['BusinessPhone2']."<br>";
	}
	
	if (trim($row['HomePhone'])!=="")
	{
	echo "Home:&nbsp;&nbsp;".$row['HomePhone']."<br>";
	}

	if (trim($row['HomePhone2'])!=="")
	{
	echo "Home 2:&nbsp;&nbsp;".$row['HomePhone2']."<br>";
	}
	
	if (trim($row['MobilePhone'])!=="")
	{
	echo "Mobile:&nbsp;&nbsp;".$row['MobilePhone']."<br>";
	}
	
	if (trim($row['BusinessFax'])!=="")
	{
	echo "Business Fax:&nbsp;&nbsp;".$row['BusinessFax']."<br>";
	}
	
	if (trim($row['EmailAddress'])!=="")
	{
	echo "E-mail:&nbsp;&nbsp;<a href='mailto:".trim($row['EmailAddress'])."'>" .trim($row['EmailAddress'])."</a><br>";
	}
	if (trim($row['Email2Address'])!=="")
	{
		echo "E-mail 2:&nbsp;&nbsp;<a href='mailto:".trim($row['Email2Address'])."'>" .trim($row['Email2Address'])."</a><br>";
	}

	if (trim($row['Email3Address'])!=="")
	{
	echo "E-mail 3:&nbsp;&nbsp;<a href='mailto:".trim($row['Email3Address'])."'>" .trim($row['Email3Address'])."</a><br>";
	}
		if (trim($row['WebPage'])!=="")
	{
	echo "Business Home Page:&nbsp;&nbsp;<a href='".trim($row['WebPage'])."'>" .trim($row['WebPage'])."</a><br>";
	}
	
	if (trim($row['Categories'])!=="")
	{
	echo "Categories:&nbsp;&nbsp;".$row['Categories']."<br>";
	}
	
	if (trim($row['Notes'])!=="")
	{
	echo trim($row['Notes']);
	}

	echo "<td>";
	if ($_SESSION['usr_level'] <>3 or $_SESSION['usr_id']==$row['user_id'])
	{
	echo "<a href=\"wabraaddressbook.php?ID=".$row['ID']."&salph=".$_GET[value]."&mod=del\">Delete</a>";
	}
	else
	{
	echo "&nbsp;";
	}
//	echo "<a href=\"library/delrec.php?ID=".$row['ID']."&salph=".$_GET[value]."\">Delete</a>";
	echo "</td>";
	
	echo "</tr>";
/*


	echo $row['FirstName'] ." <a href=\"wabraaddressbook.php?ID=".$row['ID']."\">Edit</a> &nbsp; <a href=\"library/delrec.php?ID=".$row['ID']."&salph=".$_GET[value]."\">Delete</a> <br>";
	*/
}
echo '</table>';
include 'library/closedb.php';
?>
	</td>
  </tr>
</table>
</body>
</html>
Return current item: PHP MySQL Address Book