Dear Great Ones,
I admittedly don't know what I'm doing, and I'll take all the help I can get.
The following part of the code works:
The following code in the footer doesn't work <i>when there has been some connection above.</i> If the page that calls the footer did not have a connection, the footer code works. I also tried the include_once for the dbconnection, but that didn't make a difference.
The error messages I get are as follows:
Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /a_certain_server .../common/footer.php on line 8
Warning: mysql_query(): A link to the server could not be established in /a_certain_server .../common/footer.php on line 8
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /a_certain_server ... /common/footer.php on line 9
Sorry. No records found !! main website administrative menu
What I'm trying to do is to include the administrative menu link if the currently logged in user is an administrator. I don't want it if they're not an administrator. I am use adminpro to secure the site. In spite of the errors which appear, the link for the administrative menu does appear when the user is an administrator. The errors are there, but the link appears, and it works.
Can somebody tell me how to fix?
MrsBean
I admittedly don't know what I'm doing, and I'll take all the help I can get.
The following part of the code works:
Code:
<?
include("dbconnection.php");
include_once("header.php");
blah blah blah
form data
include_once("footer.php");
?>
The following code in the footer doesn't work <i>when there has been some connection above.</i> If the page that calls the footer did not have a connection, the footer code works. I also tried the include_once for the dbconnection, but that didn't make a difference.
Code:
<?
include("dbconnection.php");
$SPhID = $_SESSION['userID'];
$sql = "SELECT * FROM phUser WHERE phID = '$SPhID'";
$result = MYSQL_QUERY($sql);
$numberOfRows = MYSQL_NUMROWS($result);
if ($numberOfRows==0) {
?>
Sorry. No records found !!
<?
}
else if ($numberOfRows>0) {
$i=0;
$thisPhID = MYSQL_RESULT($result,$i,"phID");
$thisUserName = MYSQL_RESULT($result,$i,"userName");
$thisUserPass = MYSQL_RESULT($result,$i,"userPass");
$thisUserFirstName = MYSQL_RESULT($result, $i, "userFirstName");
$thisUserLastName = MYSQL_RESULT($result, $i, "userLastName");
$thisIsAdmin = MYSQL_RESULT($result,$i,"isAdmin");
$thisUserGroup = MYSQL_RESULT($result,$i,"userGroup");
$thisSessionID = MYSQL_RESULT($result,$i,"sessionID");
$thisLastLog = MYSQL_RESULT($result,$i,"lastLog");
$thisUserRemark = MYSQL_RESULT($result,$i,"userRemark");
$thisUserEmail = MYSQL_RESULT($result,$i,"userEmail");
$thisUserHomePhone = MYSQL_RESULT($result,$i,"userHomePhone");
$thisUserCellPhone = MYSQL_RESULT($result,$i,"userCellPhone");
$thisUserOtherPhone = MYSQL_RESULT($result,$i,"userOtherPhone");
$thisUserWebsite = MYSQL_RESULT($result,$i,"userWebsite");
$thisUserStatesLicensed = MYSQL_RESULT($result,$i,"userStatesLicensed");
$thisUserDesignations = MYSQL_RESULT($result,$i,"userDesignations");
$thisUserLanguages = MYSQL_RESULT($result,$i,"userLanguages");
$thisUserSpecialties = MYSQL_RESULT($result,$i,"userSpecialties");
} ?>
<a href="[URL unfurl="true"]http://www.acertainwebsite.com/">main[/URL] website</a>
<? If ($thisIsAdmin !== 0) {
echo "<a href = '[URL unfurl="true"]http://www.acertainwebsite.com/adminindex.php'>administrative[/URL] menu</a>";
}
?>
</div>
<div id="left-menu">
<p> <a href="[URL unfurl="true"]http://www.phoenicianproperties.com/">Main[/URL] Website</a></p>
<? If ($thisIsAdmin !== 0) {
echo "<p><a href = '/phoenix/adminindex.php'>Administrative Menu</a></p>";
}
?>
</div>
The error messages I get are as follows:
Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /a_certain_server .../common/footer.php on line 8
Warning: mysql_query(): A link to the server could not be established in /a_certain_server .../common/footer.php on line 8
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /a_certain_server ... /common/footer.php on line 9
Sorry. No records found !! main website administrative menu
What I'm trying to do is to include the administrative menu link if the currently logged in user is an administrator. I don't want it if they're not an administrator. I am use adminpro to secure the site. In spite of the errors which appear, the link for the administrative menu does appear when the user is an administrator. The errors are there, but the link appears, and it works.
Can somebody tell me how to fix?
MrsBean