My site suddenly started getting these errors (I don't recall having touched anything to set it off) Line 210 in database.php is the bolded part: Line 37 in session.php is I've tried re-uploading the files and backup files, so I don't think it's a path or typo error... Can anyone help? Much appreciated.
function calcNumActiveGuests(){ /* Calculate number of guests at site */ $q = "SELECT * FROM `".TBL_ACTIVE_GUESTS."`"; $result = mysql_query($q, $this->connection); if(!$result) die($q.'<br />'.mysql_error()); $this->num_active_guests = mysql_numrows($result); } PHP: Try that
for session warnings you need to put the session_start() in the top of your script.. for header warnings you must make sure nothing output before the header function.. no echos no any html content...
This is the whole first half of my session, up to the session_start() Not sure what I do to fix it..please advise!
This is the problem TBL_ACTIVE_GUESTS If you read the output from the code you will see that the table has crashed and needs repairing. This is why you are getting errors from mysql, causing the onslaught of other minor warnings
<? class Session { var $username; //Username given on sign-up var $userid; //Random value generated on current login var $userlevel; //The level to which the user pertains var $time; //Time user was last active (page loaded) var $logged_in; //True if user is logged in, false otherwise var $userinfo = array(); //The array holding all user info var $url; //The page url current being viewed var $referrer; //Last recorded site page viewed /** * Note: referrer should really only be considered the actual * page referrer in process.php, any other time it may be * inaccurate. */ /** * startSession - Performs all the actions necessary to * initialize this session object. Tries to determine if the * the user has logged in already, and sets the variables * accordingly. Also takes advantage of this page load to * update the active visitors tables. */ function startSession(){ session_start(); //Tell PHP to start the session global $database; //The database connection } /* Class constructor */ function Session(){ $this->startSession(); $this->time = time(); } } include_once("database.php"); include("mailer.php"); include("form.php"); PHP: Try to put your code inthis order...
You need to run the SQL statement REPAIR TABLE `active_guests` If you can make a backup beforehand this is good as it will save possible loss of data should the repair go wrong Disclaimer: I take no responsibility for this going wrong. For info on repairing tables see http://dev.mysql.com/doc/refman/5.0/en/repair-table.html