We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21825
    • 1 Posts
    Hi all,

    I’ve managed to run Modx in Linux Apache, WinXP Apache & WinXP IIS. Publishing pages was all ok. However, for WinXP Apache & WinXP IIS, adding a web user generates an error. I was hoping it’ll go away with 0.95 but after testing , the same problem persists.

    Basically I’ve traced it back to the code on the file "save_web_user.processor.php" at the following lines.
    $sql = "INSERT INTO $dbase.".$table_prefix."web_user_attributes(internalKey, fullname, role, email, phone, mobilephone, fax, zip, state, country, gender, dob, photo, comment, blocked, blockeduntil, blockedafter)
    				VALUES($key, '$fullname', '$roleid', '$email', '$phone', '$mobilephone', '$fax', '$zip', '$state', '$country', '$gender', '$dob', '$photo', '$comment', '$blocked', '$blockeduntil', '$blockedafter');";
    		$rs = mysql_query($sql);
    		if(!$rs){
    			webAlert("An error occurred while attempting to save the user's attributes.");
    			exit;
    		}
    


    if(!$rs) seems to return false which triggered the error message and stopped the process. The record is created in "modx_web_users" table, but the entry in "modx_web_user_attributes" fails.

    I’m running MySQL 5.0.2a-nt in, charset: UTF-8 Unicode (utf8), connection collation: utf8_unicode_ci.

    If anyone else had a similar problem, appreciate if you can share the solution.

    Ty for Modx! Cheers,
    Nov2.
    • Did you ever make any headway towards resolving this error?
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 29289
        • 3 Posts
        I’ve also got the same problem can anyone shed any light on this please. Regards. grin


        Quote from: rthrash at Dec 27, 2006, 11:26 PM

        Did you ever make any headway towards resolving this error?
          • 18409
          • 54 Posts
          ditto.
          Windowx XP (as a development/testbed), Mysql5 PHP5.2 Apache 2.2

          Anyone?

          smiley
          • Quote from: Nov2 at Dec 07, 2006, 06:19 AM

            <?php
            // ...
            $sql = "INSERT INTO $dbase.".$table_prefix."web_user_attributes(internalKey, fullname, role, email, phone, mobilephone, fax, zip, state, country, gender, dob, photo, comment, blocked, blockeduntil, blockedafter)
            				VALUES($key, '$fullname', '$roleid', '$email', '$phone', '$mobilephone', '$fax', '$zip', '$state', '$country', '$gender', '$dob', '$photo', '$comment', '$blocked', '$blockeduntil', '$blockedafter');";
            		$rs = mysql_query($sql);
            		if(!$rs){
            			webAlert("An error occurred while attempting to save the user's attributes.");
            			exit;
            		}
            


            Hmmm... Is there any particular reason this is leveraging PHP’s mysql function mysql_query, and not the DBAPI, $modx->db->query( ... ) ? (I know, same thing in the end...)

            Not sure what the MySQL error is, but is it possible it doesn’t know what connection to run the SQL on, and bombs? Totally a guess, maybe one of the developers can shed some light?

            Also, I’m pretty sure this wouldn’t matter, but could a space be needed between web_user_attributes and (internalKey, ??

            <?php
            // ...
            $sql = "INSERT INTO $dbase.".$table_prefix."web_user_attributes(internalKey, fullname, role, 
            


            EDIT: Hmm...RE: dbAPI, probably not the issue, because apparently the issue is specific to Windows Apache/IIS huh But on *nix Apache/Lighttpd everything works, or am I mistaken?
              Mike Reid - www.pixelchutes.com
              MODx Ambassador / Contributor
              [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
              ________________________________
              Where every pixel matters.
              • 18409
              • 54 Posts
              PS - The error that mysql returns after this query is:
              "out of range value adjusted for column ’role’ at row 1"
              • Nice! ok..Possibly you could output the value from $roleid ...why is this conflicting with the datatype of `role` in the DB? Is it too long, should it be an integer, etc... Odd, though...
                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 18409
                  • 54 Posts
                  SOLUTION:

                  log into the mysql command program (ie "mysql - u root -p")and issue this command:
                  SET GLOBAL SQL_MODE=’’;

                  • Quote from: markvr at Jan 11, 2007, 04:49 PM

                    SOLUTION:

                    log into the mysql command program (ie "mysql - u root -p")and issue this command:
                    SET GLOBAL SQL_MODE=’’;

                    Some reading:


                    You can change the SQL mode at runtime by using a SET [GLOBAL|SESSION] sql_mode=’modes’ statement to set the sql_mode system value. Setting the GLOBAL variable requires the SUPER privilege and affects the operation of all clients that connect from that time on. Setting the SESSION variable affects only the current client. Any client can change its own session sql_mode value at any time.

                    Why would GLOBAL be the better choice over, say, SESSION, in this case? (Good work, BTW) Further, it might not require SUPER privileges, and could be done via SQL/mysql_query ? (...shared hosting users?)
                      Mike Reid - www.pixelchutes.com
                      MODx Ambassador / Contributor
                      [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                      ________________________________
                      Where every pixel matters.
                      • 18409
                      • 54 Posts
                      You are probably correct. Use session. I didn’t read into it too much, just a bit of googling!

                      And as this error is on my development machine, mysql security isn’t an issue as nothing other than me can use it!

                      I only have modx on the database on my laptop so did it for the whole thing.

                      This appears to be a MySQL 5 issue, to do with data integrity not a windows issue as I thought from the posts.
                      See http://dev.mysql.com/tech-resources/articles/mysql-data-integrity.html

                      Surprised it hasn’t been caught before.