Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MySQL error number 1054: Unknown column 'contact.id' in 'on clause'

    I am using an open source address book on my web site that is coded using PHP and connected to a MySQL database. I believe it was written for an older version. I am currently using PHP 5.4.23 and MySQL 5.5.32. I have no experience with PHP or MySQL, but I was able to figure out how to fix several errors. I still have two problems that I cannot figure out. I am hoping someone can help me. Thanks in advance.

    The first error I believe is just a syntax problem. I'm not exactly sure what the line is doing, but I commented it out and it works. It just doesn't get the option that tells it to open it in a popup window. The line with the problem is commented out in the following code. I'm hoping that is an easy fix.

    Code:
    // RETRIEVE OPTIONS THAT PERTAIN TO THIS PAGE
    	$options = new Options();
    
        $options = mysql_fetch_array(mysql_query("SELECT displayAsPopup FROM " . TABLE_OPTIONS . " LIMIT 1", $db_link))
    		or die(reportScriptError("Unable to retrieve options."));
        //$options->displayAsPopup = $options['displayAsPopup'];
    The other problem is that I get the following error when I try to select a group to use as a filter.
    MySQL error number 1054: Unknown column 'contact.id' in 'on clause'
    I think the problem is happening somewhere in the following code, but I'm not positive. Please let me know if I need to dig up any other code or if the database structure would help.

    PHP Code:
    <?php

        
    // DISPLAY IF NO ENTRIES UNDER GROUP
        
    if (mysql_num_rows($r_contact)<1) {
            echo(
    "                 <TR VALIGN=\"top\">\n");
            echo(
    "                   <TD WIDTH=560 COLSPAN=4 CLASS=\"listEntry\">$lang[NO_ENTRIES]</TD>\n");

            echo(
    "                 </TR>\n");
        }
        
    // DISPLAY ENTRIES
        
    while ($tbl_contact mysql_fetch_array($r_contact)) {

            
    $contact_fullname stripslashes$tbl_contact['fullname'] );
            
    $contact_lastname stripslashes$tbl_contact['lastname'] );
            
    $contact_firstname stripslashes$tbl_contact['firstname'] );
            
    $contact_id $tbl_contact['id'];
            
    $contact_line1 stripslashes$tbl_contact['line1'] );
            
    $contact_line2 stripslashes$tbl_contact['line2'] );
            
    $contact_city stripslashes$tbl_contact['city'] );
            
    $contact_state stripslashes$tbl_contact['state'] );
            
    $contact_zip stripslashes$tbl_contact['zip'] );
            
    $contact_phone1 stripslashes$tbl_contact['phone1'] );
            
    $contact_phone2 stripslashes$tbl_contact['phone2'] );
            
    $contact_country $tbl_contact['country'];
            
    $contact_whoAdded $tbl_contact['whoAdded'];
            if (
    $contact_whoAdded == $_SESSION['username'] && $_SESSION['usertype'] == 'user' ) {
                
    $thecolor ' STYLE="background-color: #EEEEEE;"';
            }      

            
    $list_NewLetter strtoupper(substr($contact_fullname01));
            if (
    $list_NewLetter != $list_LastLetter) {
                echo(
    "                 <TR VALIGN=\"top\">\n");
                echo(
    "                   <TD WIDTH=410 COLSPAN=3 CLASS=\"listHeader\">$list_NewLetter<A NAME=\"$list_NewLetter\"></A></TD>\n");
                echo(
    "                   <TD WIDTH=150 COLSPAN=1 CLASS=\"listHeader\" ALIGN=\"right\" VALIGN=\"bottom\"><A HREF=\"#top\"><IMG SRC=\"images/uparrow.gif\" WIDTH=10 HEIGHT=10 BORDER=0 ALT=\"[top]\"></A></TD>\n");
                echo(
    "                 </TR>\n");
            }

            echo(
    "                 <TR".$thecolor." VALIGN=\"top\">\n");
            
    // DISPLAY NAME -- links are shown either as regular link or popup window
            
    if ($options->displayAsPopup == 1) {
                
    $popupLink " onClick=\"window.open('" FILE_ADDRESS "?id=$contact_id','addressWindow','width=600,height=450,scrollbars,resizable,menubar,status'); return false;\"";
            }
            if (!
    $contact_firstname) {
                echo(
    "<TD WIDTH=150 CLASS=\"listEntry\"><B><A HREF=\"" FILE_ADDRESS "?id=$contact_id\"$popupLink>$contact_lastname</A></B></TD>\n");
            }
            else {
                echo(
    "<TD WIDTH=150 CLASS=\"listEntry\"><B><A HREF=\"" FILE_ADDRESS "?id=$contact_id\"$popupLink>$contact_fullname</A></B></TD>\n");
            }
            
    // DISPLAY PHONE NUMBER OF PRIMARY ADDRESS
            
    echo("<TD WIDTH=100 CLASS=\"listEntry\">");
            if (
    $contact_phone1) { echo("$contact_phone1"); }

            if (
    $contact_phone1 AND $contact_phone2) { echo("<BR>"); }
            if (
    $contact_phone2) { echo("$contact_phone2"); }
            echo(
    "&nbsp;</TD>\n");
            
    // DISPLAY ADDRESS - shown only if the first line of the address exists.
            
    echo("                   <TD WIDTH=160 CLASS=\"listEntry\">");
            if (
    $contact_line1) { 
                echo(
    "$contact_line1<BR>");
                if (
    $contact_line2) { echo("$contact_line2<BR>"); }
                if (
    $contact_city) { echo("$contact_city"); }
                if (
    $contact_city AND $contact_state) { echo (", "); }
                if (
    $contact_state) { echo("$contact_state"); }
                if (
    $contact_zip) { echo(" $contact_zip"); }
                
    // COUNTRY
                
    if ($contact_country) { 
                    echo(
    "\n<br>$country[$contact_country]");
                }
            }
            echo(
    "&nbsp;</TD>\n");
            
    // DISPLAY E-MAILS
            
    echo("<TD WIDTH=150 CLASS=\"listEntry\">");
            
    $r_email mysql_query("SELECT id, email FROM " TABLE_EMAIL " AS email WHERE id=$contact_id"$db_link);
            
    $tbl_email mysql_fetch_array($r_email);
            
    $email_address $tbl_email['email'];
            if (
    $options->useMailScript == 1) {
                echo(
    "<A HREF=\"" .FILE_MAILTO"?to=$email_address\">$email_address</A>");
            }
            else {
                echo(
    "<A HREF=\"mailto:$email_address\">$email_address</A>");
            }
            while (
    $tbl_email mysql_fetch_array($r_email)) {
                
    $email_address $tbl_email['email'];
                if (
    $options->useMailScript == 1) {
                    echo(
    "<BR><A HREF=\"" .FILE_MAILTO"?to=$email_address\">$email_address</A>");
                }
                else {
                    echo(
    "<BR><A HREF=\"mailto:$email_address\">$email_address</A>");
                }       
            }
            echo(
    "&nbsp;</TD>\n");
            echo(
    "</TR>\n");
            
            
    $list_LastLetter strtoupper(substr($contact_fullname01));

            
    //reset background color
            
    $thecolor "";

        
    // END WHILE
        
    }

    ?>

  • #2
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts
    Unknown column 'contact.id' in 'on clause'
    You should look for that, and it is not there in your code
    Should be inside sql coz the eror is from db.

    Sql wanting somethng that is not in db.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #3
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have already searched the code and was unable to find anything.

    Also, for the first issue I mentioned, the error I am getting is below.

    Warning: Attempt to assign property of non-object in mywebsite/search.php on line 37

  • #4
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts
    Unknown column 'contact.id' in 'on clause'
    Then mybe the thing is hidden inside the trigger or somewhere else (proc,func,view) in database
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #5
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I finally found the solution to the second problem, which was the most important of the two. I found it here: http://sourceforge.net/p/theaddressbook/bugs/12/

    I am still trying to figure out the first issue.

  • #6
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As I said before, I don't really know anything about MySQL or PHP, but I'm slowly figuring it out.

    I figured out that this line is doing a SQL query to a specific table. It will retrieve either a 1 or a 0. Or it will return an error. Also, that row in the database is configured as an "int(1)" and does not accept null values.
    Code:
    $options = mysql_fetch_array(mysql_query("SELECT displayAsPopup FROM " . TABLE_OPTIONS . " LIMIT 1", $db_link))
    		or die(reportScriptError("Unable to retrieve options."));
    So at this point $options should equal 1 with my current configuration. Then, I don't really understand what the next line is trying to do, but this is the line that fails.
    Code:
    $options->displayAsPopup = $options['displayAsPopup'];
    I'm not sure if I'm using the correct terminology for this language, but $options seems like a UDT which appears to be defined by the following code. Maybe that is where the problem is. I really have no idea what is going on in there though.
    PHP Code:
    <?php
    /*************************************************************
     *  THE ADDRESS BOOK  :  version 1.04
     *  
     *  lib/class-options.php
     *  Object: retrieve and set global or user options
     *
     *************************************************************/

     
    class Options {
        
        
    // DECLARE OPTION VARIABLES
        
    var $bdayInterval;
        var 
    $bdayDisplay;
        var 
    $displayAsPopup;
        var 
    $useMailScript;
        var 
    $picAlwaysDisplay;
        var 
    $picWidth;
        var 
    $picHeight;
        var 
    $picDupeMode;
        var 
    $picAllowUpload;
        var 
    $modifyTime// not currently in use; reserved for future use
        
    var $msgLogin;
        var 
    $msgWelcome;
        var 
    $countryDefault;
        var 
    $allowUserReg;
        var 
    $eMailAdmin;
        var 
    $requireLogin;
        var 
    $language;
        var 
    $defaultLetter// test
        
    var $limitEntries// test
        
        // DECLARE OTHER VARIABLES
        
    var $global_options;
        var 
    $user_options;
        var 
    $message;

        
        
    // CONSTRUCTOR FUNCTION
        
    function Options() {
            
    $this->get();
        }
        
        function 
    get() {
            
    // This function retrieves global options first. Then, it retrieves user options
            // if a user name is available, which will overwrite certain global options.
            
    $this->set_global();
            if ((isset(
    $_SESSION['username'])) && ($_SESSION['username'] != '@auth_off')) {
                
    $this->set_user();
            }
        }
        
        function 
    set_global() {
            
    // This function restores all options to the administrator-specified global settings.
            // Call this function when you need to ignore the user-specified settings.
            // Note: If you do not call this function, you can still obtain global settings
            // directly using the $this->global_options variable.
            
    global $db_link;
            
            
    $this->global_options mysql_fetch_array(mysql_query("SELECT * FROM " TABLE_OPTIONS " LIMIT 1"$db_link))
                    or die(
    reportScriptError("Unable to retrieve global options."));

            
    $this->bdayInterval     $this->global_options['bdayInterval'];
            
    $this->bdayDisplay      $this->global_options['bdayDisplay'];
            
    $this->displayAsPopup   $this->global_options['displayAsPopup'];
            
    $this->useMailScript    $this->global_options['useMailScript'];
            
    $this->picAlwaysDisplay $this->global_options['picAlwaysDisplay'];
            
    $this->picWidth         $this->global_options['picWidth'];
            
    $this->picHeight        $this->global_options['picHeight'];
            
    $this->picDupeMode      $this->global_options['picDupeMode'];
            
    $this->picAllowUpload   $this->global_options['picAllowUpload'];
            
    $this->modifyTime       $this->global_options['modifyTime'];
            
    $this->msgLogin         stripslashes$this->global_options['msgLogin'] );
            
    $this->msgWelcome       stripslashes$this->global_options['msgWelcome'] );
            
    $this->countryDefault   $this->global_options['countryDefault'];
            
    $this->allowUserReg     $this->global_options['allowUserReg'];
            
    $this->eMailAdmin       $this->global_options['eMailAdmin'];
            
    $this->requireLogin     $this->global_options['requireLogin'];
            
    $this->language         $this->load_lang($this->global_options['language']);
            
    $this->defaultLetter    $this->global_options['defaultLetter'];
            
    $this->limitEntries     $this->global_options['limitEntries'];
        }
        
        function 
    set_user() {
            
    // This function overrides admin-specified options with user options.
            // Call this function if you need to restore the user settings after resetting
            // to global settings.
            // Note: If you do not call this function, you can still obtain the user settings
            // directly using the $this->user_options variable.
            
    global $db_link;
            
            
    $this->user_options mysql_fetch_array(mysql_query("SELECT * FROM " TABLE_USERS " WHERE username='" $_SESSION['username'] . "' LIMIT 1"$db_link))
                    or die(
    reportScriptError("Unable to retrieve user options."));

            if (!
    is_null($this->user_options['bdayInterval']))   $this->bdayInterval $this->user_options['bdayInterval'];
            if (!
    is_null($this->user_options['bdayDisplay']))    $this->bdayDisplay $this->user_options['bdayDisplay'];
            if (!
    is_null($this->user_options['displayAsPopup'])) $this->displayAsPopup $this->user_options['displayAsPopup'];
            if (!
    is_null($this->user_options['useMailScript']))  $this->useMailScript $this->user_options['useMailScript'];
            if (!
    is_null($this->user_options['language']))       $this->language $this->load_lang($this->user_options['language']);
            if (!
    is_null($this->user_options['defaultLetter']))  $this->defaultLetter $this->user_options['defaultLetter'];
            if (!
    is_null($this->user_options['limitEntries']))   $this->limitEntries $this->user_options['limitEntries'];
        }
        
        function 
    save_global() {
            
    // This function saves global settings to the database, in the options table.
            // It assumes that the options have already been placed in the $_POST superglobal.
            
    global $db_link;
            global 
    $lang;

            
    // CHECK NUMERICAL INPUT
            // This is DIFFERENT from the previous implemenation (TAB 1.03 and earlier)
            // where empty or faulty information resulted in resetting the value to a
            // hard-coded default value. Here, it will check if the $_POST value is valid,
            // and if so, it will overwrite the existing setting. Otherwise the original
            // value (whatever it is) is retained.
            
    if (($_POST['bdayInterval'] > 0) && is_numeric($_POST['bdayInterval']))     $this->bdayInterval $_POST['bdayInterval'];
            if ((
    $_POST['picWidth'] > 0) && is_numeric($_POST['picWidth']))             $this->picWidth $_POST['picWidth'];
            if ((
    $_POST['picHeight'] > 0) && is_numeric($_POST['picHeight']))           $this->picHeight $_POST['picHeight'];
            if ((
    $_POST['picDupeMode'] == 1) || ($_POST['picDupeMode'] == 2) || ($_POST['picDupeMode'] == 3))  $this->picDupeMode $_POST['picDupeMode'];
            if ((
    $_POST['countryDefault']))                                             $this->countryDefault $_POST['countryDefault'];
            if ((
    $_POST['limitEntries'] >= 0) && is_numeric($_POST['limitEntries']))    $this->limitEntries $_POST['limitEntries'];
            
            if (
    $_POST['language']) $this->language $_POST['language'];    // not numerical, but the same principle applies
            
    $this->defaultLetter = (empty($_POST['defaultLetter'])) ? "" $_POST['defaultLetter']; // if no value is sent, then turn defaultLetter off (note: off must be empty string, NOT 0 value)

            // CLEAN UP STRING INPUT
            // These are allowed to be blank. We will take these "as is" -- no checking is done.
            
    $this->msgLogin   addslashes(strip_tags(trim($_POST['msgLogin']),'<a><b><i><u><p><br>'));
            
    $this->msgWelcome addslashes(strip_tags(trim($_POST['msgWelcome']),'<a><b><i><u><p><br>'));
            
            
    // CHECKBOXES
            // If the variable does not exist in $_POST, that means the checkbox is turned off!
            // Give it a value of 0 so we know what to enter into the database.
            // Everything else results in 1 (which should be the contents of the $_POST variable anyway, but let's be sure
            
    $this->bdayDisplay      = (empty($_POST['bdayDisplay'])) ? 1;
            
    $this->displayAsPopup   = (empty($_POST['displayAsPopup'])) ? 1;
            
    $this->useMailScript    = (empty($_POST['useMailScript'])) ? 1;
            
    $this->picAlwaysDisplay = (empty($_POST['picAlwaysDisplay'])) ? 1;
            
    $this->picAllowUpload   = (empty($_POST['picAllowUpload'])) ? 1;
            
    $this->allowUserReg     = (empty($_POST['allowUserReg'])) ? 1;
            
    $this->eMailAdmin       = (empty($_POST['eMailAdmin'])) ? 1;
            
    $this->requireLogin     = (empty($_POST['requireLogin'])) ? 1;

            
    // CREATES THE QUERY AND UPDATES THE OPTIONS TABLE
            
    $sql "UPDATE " TABLE_OPTIONS " SET 
                    bdayInterval      = $this->bdayInterval,
                    bdayDisplay       = $this->bdayDisplay,
                    displayAsPopup    = $this->displayAsPopup,
                    useMailScript     = $this->useMailScript,
                    picAlwaysDisplay  = $this->picAlwaysDisplay,
                    picWidth          = $this->picWidth,
                    picHeight         = $this->picHeight,
                    picDupeMode       = $this->picDupeMode,
                    picAllowUpload    = $this->picAllowUpload,
                    modifyTime        = $this->modifyTime,
                    msgLogin          = '$this->msgLogin',
                    msgWelcome        = '$this->msgWelcome',
                    countryDefault    = '$this->countryDefault',
                    allowUserReg      = $this->allowUserReg,
                    requireLogin      = $this->requireLogin,
                    eMailAdmin        = $this->eMailAdmin,
                    language          = '$this->language',
                    defaultLetter     = '$this->defaultLetter',
                    limitEntries      = $this->limitEntries"
    ;

            
    mysql_query($sql$db_link)
                or die(
    reportSQLError($lang['ERR_OPTIONS_NO_SAVE']));

            
    $this->get();
            
    $this->message $lang['OPT_SAVED'];

            return 
    true;
        }
        
        
        function 
    save_user() {
            
    // This function saves user settings to the database, in the users table.
            // This is largely similar in function to save_global() except that there are much fewer
            // options to deal with. It may be better to condense the two functions into 
            // one function so as to avoid repetition of code but we can worry about that later.
            
    global $db_link;
            global 
    $lang;
            
            
    // CHECK INPUT
            // Condensed version of events from save_global().
            
    if (($_POST['bdayInterval'] > 0) && is_numeric($_POST['bdayInterval']))     $this->bdayInterval $_POST['bdayInterval'];
            if ((
    $_POST['limitEntries'] >= 0) && is_numeric($_POST['limitEntries']))    $this->limitEntries $_POST['limitEntries'];
            if (
    $_POST['language']) $this->language $_POST['language'];
            
    $this->defaultLetter    = (empty($_POST['defaultLetter'])) ? "" $_POST['defaultLetter'];
            
    $this->bdayDisplay      = (empty($_POST['bdayDisplay'])) ? 1;
            
    $this->displayAsPopup   = (empty($_POST['displayAsPopup'])) ? 1;
            
    $this->useMailScript    = (empty($_POST['useMailScript'])) ? 1;

            
    // CREATES THE QUERY AND UPDATES THE OPTIONS TABLE
            
    $sql "UPDATE " TABLE_USERS " SET 
                    bdayInterval      = $this->bdayInterval,
                    bdayDisplay       = $this->bdayDisplay,
                    displayAsPopup    = $this->displayAsPopup,
                    useMailScript     = $this->useMailScript,
                    language          = '$this->language',
                    defaultLetter     = '$this->defaultLetter',
                    limitEntries      = $this->limitEntries
                    WHERE username='" 
    $_SESSION['username'] . "'";
            
    mysql_query($sql$db_link)
                or die(
    reportSQLError($lang['ERR_OPTIONS_NO_SAVE']));
            
            
    $this->get();
            
    $this->message $lang['OPT_SAVED_USER'];

            return 
    true;
        }
        
        function 
    reset_user() {
            
    // This function is designed to clear the user's settings and have all option variables
            // set to NULL in the database. NULL means neither yes or no, and will force the
            // script to look to the global options table for information.
            
    global $db_link;
            global 
    $lang;

            
    // QUERY
            
    $sql "UPDATE " TABLE_USERS " SET 
                    bdayInterval      = NULL,
                    bdayDisplay       = NULL,
                    displayAsPopup    = NULL,
                    useMailScript     = NULL,
                    language          = NULL,
                    defaultLetter     = NULL,
                    limitEntries      = NULL
                    WHERE username='" 
    $_SESSION['username'] . "'";
            
    mysql_query($sql$db_link)
                or die(
    reportSQLError($lang['ERR_OPTIONS_NO_SAVE']));
            
            
    // RESET MEMBER VARIABLES
            
    $this->set_global();    
            
            
    $this->message $lang['OPT_RESET_USER'];
            return 
    true;
        }
            
        function 
    load_lang($file) {
            global 
    $php_ext;
            
    // The following variables are loaded from country files. Make these global scope
            
    global $lang;
            global 
    $country;
            
            
    $fullpath dirname($_SERVER['SCRIPT_FILENAME']) . '/' PATH_LANGUAGES $file '.' $php_ext;
            
    // This function takes the value returned by the 'language' column in global or user options table,
            // and checks to make sure that the file exists in the /language directory. If it exists, it loads
            // the language into memory. If it does not exist, it attempts to loads 'english' (the default language).
            
    if (file_exists($fullpath)) {
                require_once(
    $fullpath);
                return 
    $file;
            } else {
                require_once(
    dirname($_SERVER['SCRIPT_FILENAME']) . '/' PATH_LANGUAGES 'english.' $php_ext);
                
    $this->message $lang['OPT_LANGUAGE_MISSING'];
                return 
    'english';
            } 
        }
        
    // END Options
    }


    ?>

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    I'm having trouble following this thread so I'm not sure what is still a problem and what isn't.
    Your first issue isn't in the block of code you've provided. In particular, it specifies that a property doesn't exist in an ON condition. That means its looking for a JOIN query, which is not present here.

    The second error is for the object dereference. It simply states that the property you are specifying isn't being attached to an object. So if its $options, than $options hasn't been defined at this point as an object prior to attempting to write to it.

    You'll need to follow the trace for the spot causing either of the error messages.

    Also, this PHP class is very, very old. PHP 4.4.9 was officially retired on August 7, 2008 and was the final 4.x branch of PHP released. So the code you have here is over 5 years old now, you should probably replace it with code designed to run in the object oriented core of PHP 5.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #8
    New to the CF scene
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Basically, my last post talks about the problem I am still having. I am getting an error that says:
    Warning: Attempt to assign property of non-object in /public_html/members/search.php on line 37

    Warning: Cannot modify header information - headers already sent by (output started at /public_html/members/search.php:37) in /public_html/members/search.php on line 114
    Before, I commented out the line that says
    $options->displayAsPopup = $options['displayAsPopup'];
    and it no longer gets an error, but it also doesn't open in a popup window.

    Now I commented out all three lines below and it works. It even opens in the popup window. I think that should work for me. I am just wondering if that means it is going to ignore the user settings and just use the global default settings.
    //$options = mysql_fetch_array(mysql_query("SELECT displayAsPopup FROM " . TABLE_OPTIONS . " LIMIT 1", $db_link))
    // or die(reportScriptError("Unable to retrieve options."));
    // $options->displayAsPopup = $options['displayAsPopup'];

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Yes that would use the global from the code in the class.
    Although I can't believe that I missed this:
    Code:
    $options = new Options();
    $options = mysql_fetch_array(mysql_query("SELECT displayAsPopup FROM " . TABLE_OPTIONS . " LIMIT 1", $db_link))
    		or die(reportScriptError("Unable to retrieve options."));
    You've overwritten the Options object with the result resource form the fetched query. Change the second one to a different variable and then dereference the array in the line after with the new variable name.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •