Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by LLLLLLL

  1. I understand what you're saying here, and I will take a look at making these changes. However, I am still unable to explain that third bullet point above, as it has nothing to do with the database. In short:

    1) I copied français into a text file and saved it.

    2) When I edited the text file again, it had the jibberish text.


    Wassup with that? I'm using cPanel to do these "saves", and its encoding is indeed utf-8

  2. Hi, I'm still looking for an answer to this. Here is more information:

    • I copied the text français into a database upgrade file (text file)
    • That text got inserted into the DB as Français. (When I view the data in phpMyAdmin)
    • The text must have saved that way in the text file, too (when did it change?)
    • This text DOES now display as français


    So should I be happy that it displays correctly? Should I not care how phpMyAdmin displays it?  Sigh, so complicated


  3. I have a MySQL DB table and DB column with utf8_unicode_ci collation. I'm getting two columns out of the DB, one with the name of a language in English, the other a name of the language in the native tongue. The values in the database store/display properly from PHP MyAdmin.


    However, the "native-tongue" text does not display properly on the site. (See attached image.)


    I tried htmlentities( $str, ENT_COMPAT, 'UTF-8' ) for displaying, but that seems to make things worse (French, Portuguese, Spanish, and Turkish all display as empty; something I have not seen before).


    I thought that the htmlentities function should cure this, but since it does not, I am stumped. Any help is appreciated.


    [attachment deleted by admin]

  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    This works for simply displaying text. However, in the few places that my text is an attribute, I still need to call htmlentities( $str ), but I need to use all three parameters as explained above:

    htmlentities( $str, ENT_COMPAT, 'UTF-8' )


    So it looks like my solution is a combination of both. I guess that's the best PHP can do for me right now.

  5. QuickOldCar's solution didn't work for me (I had already tried that) but I will look into the idea from requinix.


    I noticed that when my string was called with htmlentities( $string) it showed the jibberish, but htmlentities( $string, ENT_COMPAT, 'UTF-8' ) worked as expected. Clearly I'd rather set the page to be UTF-8 than to call this html entities stuff every time.


    I hope what you're saying will work. I'll get back to you.

  6. I saw another thread here about utf8_encode, but that doesn't seem to help me, even though the issues seem about the same.


    My application has a configuration area where you create products, and the ordering area where customers order them. I'm confused about accent handling, and character sets in general.


    Some notes:

    * When é is added to a field (configuration area) that displays as a textbox, the user saves and then the character displays as nonsense.

    * When é is added to a textarea field in the configuration area, the user saves and then the character displays properly.

    * In either case, the é character does not appear correctly in HTML in the customer ordering area.



  7. Yes, I read the link on his first reply, but (obviously) I'm still unclear. The information is just too vague for me, mostly because:

    1) I don't know where to put that code. In a config file? Okay, then...

    2) What is this frontend controller stuff that knows how to find the config file?


    I'm not trying to offend anyone, but I truly don't feel any answer has been specific to these questions. Hence the back-and-forth.


    Thank you again for your time.

  8. I desperately want to pursue specific questions. If you prefer to email me (does this forum allow it?) please do so.


    My problem is simple: I have a bunch of files that are in a folder that must be in the include path. The only way I know to set the include path is to tell a customer to set their php.ini (or ask their web host for help determining how to set the path). I don't want to do that any more, and I want to know how to avoid it.


    I understand what the php.ini file is. I understand why I don't want to tell people to change it. I understand what include paths are. That's my whole point.


    I understand what __FILE__ is now, but you said The call to __FILE__ can be done in the config file; and I don't know what "the config file" is. Sounds to me like I'd need to alter every file to find this config file.


    Specifically, I have structure like this

    • Root
      • classes
      • some other folder
      • a bunch of files


    The "bunch of files" may include some class from the classes folder. Also a bunch of files in the other folders include classes from the classes folder. I call this by...


    include( 'someclass.php' );


    ... without a path. Because it's set in php.ini. How else can I set it. Where does the mythical config file go? What is the mechanism that reads it?


    Thank you.

  9. Yes, but as I do not understand the description above - I'm only told to "reread above and/or the link" - I am stuck this way.


    I would like to have clearer instructions, please. I want to put some code in some place to fix this. I truly do not understand those two instructions, and I have asked a few times. Please be patient with me; but I do not feel I've received a response that dumbs it down enough for me.

  10. I have talked with some local developers and they say that I should just generate a sample htaccess and php.ini, because there's no way to ever get it right (especially when one class includes another and then another) in the ways discussed here.


    When you say to use __FILE__, that still sounds like something done for every source file, so this doesn't seem possible:


    All it needs to do is set the base path based on where it is running from, which is an automagic PHP feature:  "Oh, the application is running from *here*". 


    Sorry but the information here isn't very clear to me, and if other developers I know say to use php.ini, I guess that's the best way.

  11. You simply create your application so the bootstrap script is always called no matter what page is reqested.


    Sorry to be such an ignoramus, but I don't know how this is done.  :-[


    Again, I know the code, but not this environmental setup stuff. I appreciate your replies.

  12. You would put it in an initialization of your bootstrap or main controller script.


    Sorry, I don't understand this. Can you explain it? I know PHP code, but virtually nothing about the setup environment. Also, remember that my code is being run on other people's servers in which I cannot possibly know the environment... so how can I configure this bootstrap/controller script to work for everyone?


    Thanks again.

  13. OK. Well I did essentially suggest that in the original post ("I guess I could use set_include_path on the top of a bunch of files"), but this may be difficult with the AJAX calls and such. I'll have to test it. I didn't know about __FILE__ before, so that should be helpful.


    Also, what is $_PATHS? I don't see this documented anywhere.

  14. I'm just looking for some tips here. I am developing and selling an eccommerce shopping cart software package, and it has been received very well from the early adopters. There's just one small problem that prevents the software from being a truly out-of-the-box solution: the include path. Not all users have access to their php.ini file, and it's not always a php.ini file anyway. So this is something the installation is unable to set for the customer.


    I'm using object-oriented PHP5 stuff, so I have a folder named "classes" with all the relevant stuff in there. I am unable to search for paths to the folder and hard-code those into source files (there are ajax calls and other fun stuff; hard to know the exact relation to the path).


    I guess I could use set_include_path on the top of a bunch of files, but that is a small performance hit (and totally inelegant code). I could put the folder path in the database somewhere and query for it (and cache it so it's not a performance hit). None of this stuff seems good. The path seems like the best solution.


    Unless you have better ideas.... :)

  15. Tried lots of terms, and it seems "ended" is the trick:


    document.getElementById('audio-player3').addEventListener('ended', function(){

                            // change the image back.

        }, false);

  16. I've created an HTML5 audio player. Very basic (which is what I want)... it's a single play button that changes to a "pause" button once you've started playing, done through JavaScript. What I want to happen is that when the audio file reaches the end, the "play" button displays again.


    Is there some event that fires when the audio is complete? I've been to all the related forums and can't find any information. This stuff is not well documented yet.


    Or if you have a better solution altogether, I'm up for that as well.

  17. Nevermind... thought I did this but I guess not:


    update TABLE_TO_UPDATE set some_field = concat( ( select value from TABLE_TO_SELECT where `option` = 'someoptionname' ), 'this_is_my_static_text' )

  18. I'm trying to do something super simple so I'm sure I'll get a correct answer right away. Thanks in advance. I just need the correct syntax to update a table with a value from another table PLUS some static text. My question is purely about the proper syntax. My error-prone syntax (result is a "0" in the field) is the following...


    update TABLE_TO_UPDATE set some_field = ( select value from TABLE_TO_SELECT where `option` = 'someoptionname' ) + 'this_is_my_static_text'


    ... where did I go wrong? (I've tried other methods, like CONCAT, but not getting it.)

  19. Sorry but that doesn't make sense. There's no "changing" value; what I have shown here is a result set.


    I've found a workaround: a subselect in the query that will show me the total rows. This is shown below. It will help me since I can just parse the results to determine 1,2,3,etc. for the row. Not really what I wanted, but it will do.

    Col 1    Col 2      Col 3
    X        ABC        4
    X        DEF        4
    X        GGH        4
    Y        Blah       1
    Z        Foo        2
    X        Bar        4
    Z        Something  2
    G        Foobar     1


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.