Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

11 Good

1 Follower

About iwato

  • Rank
    Dedicated Member

Contact Methods

  • AIM
  • Website URL
  • Yahoo
  • Skype

Profile Information

  • Gender
  • Location
    Seattle, Washington USA 98104

Previous Fields

  • Languages
    HTML, CSS, Javascript, PHP, MySQL and Spoken Language

Recent Profile Visitors

13,966 profile views
  1. Class Variable Declaration

    JSG: I have never used the fetch_all( ) method in this context -- only the fetch_assoc( ) method --, and it does not work in the context provided. Roddy
  2. Class Variable Declaration

    JSG: For someone who is always asking for code, you are very reluctant to provide it. A simple example in the context of the class provided would be extremely helpful. Roddy
  3. Class Variable Declaration

    JSG: Please select one of any of the provided class functions that contain "ordinary variables" and show me how you would declare them in the context of the class provided. davej: Why would you make the private and not public?
  4. No access to CSS

    Submit a CSS stylesheet with your work and insure that it is specific to the HTML elements of your document. Roddy
  5. You might wish to begin here. In regard to your button, you might try floating it or placing the entire bar in a flex box. Button and forms have a mind of their own. Roddy p.s. If you find my entry helpful, hover over the heart and click on the trophy.
  6. Class Variable Declaration

    BACKGROUND: I am now running with PHP 5.5.38, and things are nearly back to normal. My error messages have returned, and things that once worked, now function well again. This said, I wish to make good on the pain and disappointment that I suffered and am requesting your help to do so. REQUEST: Please find below a PHP class that I created in order to gather data from my database. It works fine in my current PHP environment and produces the expected results. It has been upgraded to handle multiple languages and editions of the same letter number. In addition, I have included a list of suspect variables -- namely, variables whose undeclared status may have been a source of difficulty while running in my previous PHP 5.6.33 environment. class Newsletter { public $letter_no; public $letter_lang; public $mysqli_obj; public $letter_ed; public $pc_total; public $podcasts; public function __construct($letter_no, $letter_lang, $mysqli_obj, $letter_ed = 1) { $this->letter_no = $letter_no; $this->letter_lang = $letter_lang; $this->mysqli_obj = $mysqli_obj; $this->letter_ed = $letter_ed; } public function get_letter_data() { $sql = "SELECT letter.*, qa.* FROM sevengates_letter AS letter JOIN sevengates_qa AS qa ON letter.letter_no = qa.letter_no WHERE letter.letter_no = ? AND letter.letter_lang = ? ORDER BY letter.letter_ed DESC"; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('is', $this->letter_no, $this->letter_lang); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $letter_results[$name] = $value; } } return $letter_results; } public function get_nextletter_data() { $next_letter_no = $this->letter_no + 1; $sql = "SELECT letter_no, letter_title, letter_abstract FROM sevengates_letter WHERE letter_no = ?"; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $next_letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } $mysqli_stmt->free_result(); foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $nextletter_results[$name] = $value; } } return $nextletter_results; } public function get_podcasts() { $sql = "SELECT podcast_ref FROM sevengates_podref WHERE letter_no = ?"; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $this->letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } $i = 1; foreach ($prelim_result as $arr) { foreach ($arr as $name => $value) { $name = $name . '_' . $i; $podcasts[$name] = $value; } $i++; } $this->pc_total = count($podcasts); return $podcasts; } public function get_podcasts_data($podcasts) { $this->podcasts = $podcasts; $prelim_result = []; $c = []; $row = []; $podcast_results = []; foreach ($podcasts as $name => $value) { $params = []; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $sql = "SELECT item_podtype, podcast_no_item, item_title, item_description, item_guid FROM rss2_podcast_item WHERE podcast_no_item = ?"; $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $value); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } } $prelim_result[] = $c; $mysqli_stmt->free_result(); } foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $pc_result[$name] = $value; } $podcast_results[] = $pc_result; } return $podcast_results; } public function get_pc_total() { return $this->pc_total; } } LIST OF SUSPECT VARIABLES $params = []; $prelim_result = []; $c = []; $letter_results = []; $next_letter_results = []; $row = []; $podcast_results = []; DISCUSSION I feel fairly comfortable with handling certain kinds of variables, but very uncomfortable handling others. In fact, I am not at all sure why the above class works, as it took a lot of guess work to make it function. Guess work is inefficient. QUESTION: How does one properly declare class variables that are not related to the arguments of the constructor function? Please provide examples from the list and code provided. Roddy
  7. Please ignore this question. The problem has been resolved. Roddy
  8. Error 500 - Probable Causes

    I have just received a copy of the stock php.ini file that Lunarpages (my web host server) is using. Hopefully, it will lend a clue into what is going on and how to adjust for it. Roddy
  9. Php.ini file?

    You may or may not have access to it depending on the nature of your account. I suggest that you contact your host. If you do not have access to the file, there is a good chance that you can change the setting of interest dynamically. Further, if it is a setting that you wish to use repeatedly, then you should follow Dsonesuk's suggestion below. Another way to discover the location of the file and thus avoid having to contact your host is to run the phpinfo( ) function on your host server. This will tell you everything that you can know about the PHP processor running on your host's server. Roddy p.s. If you find my answer helpful, then hover over the heart, find the trophy, and click. Thanks after the fact, is better than than thanks before it.
  10. Error 500 - Probable Causes

    Dsonesuk: What version of PHP are you using? INGOLME: Please find attached your requested information for the HTTPRequest error code 500 Roddy firefox_network_results.tiff
  11. DILEMMA: My goal is to style the body of a newsletter template. Although I am able to get the formatting into the database and -table, I am unable to retrieve it for insertion in the newsletter's template. Please find below an example of the way in which the value string of only one of the several SQL INSERT statements is created. The string that results is later combined with a name string and other elements of a valid INSERT statement. EXAMPLE OF THE WAY THE INSERTED VALUE IS FORMATTED include_once('../_utilities/php/classes/class.lunarpages.php'); $lunarpages = new Lunarpages(); $mysqli_obj = $lunarpages->get_mysqli_obj(); var_dump($mysqli_obj); $sql_letter_val = "('"; $substr_start = 0; $substr_length = 8; foreach ($newsvar_names as $name => $value) { if (substr($name, $substr_start, $substr_length) == '$letter_') { $sql_letter_val .= $mysqli_obj->real_escape_string($value) . "', '"; } } WHAT APPEARS IN THE DATA TABLE AFTER INSERTION <h1>ようこそ!</h1> <p>「<span style='font-family:Bradley Hand, cursive;font-size:1.8em;'>Seven Gates</span>」と言うのは文法キャプチッブのオンラインニューズレターです。</p> <p>このニューズレターの初版は文法キャプチッブの紹介としてニューズレターの構成及び文法キャプチッブの本質をユーザー達にその母語で説明しています。第二版のニューズレター以降のニューズレターは英語で書いてあるものです。もしニューズレターの初版を英語でも読んだ方が好いとすれば、ウェブ型の変形が<a href='https://www.grammarcaptive.com/?newsletter=1' title='Seven Gates - Edition No. 1' target='_blank'>ここに</a>見付かります。</p> THE RETRIEVAL CODE public function get_letter_data() { $sql = "SELECT letter.*, qa.qa_question, qa.qa_answer FROM sevengates_letter AS letter JOIN sevengates_qa AS qa ON qa.letter_no = letter.letter_no WHERE letter.letter_no =?"; $mysqli_stmt = $this->mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $this->letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $letter_results[$name] = $value; } } return $letter_results; } WHAT IS RETRIEVED and APPEARS IN THE NEWSLETTER ようこそ! DISCUSSION: Everything after the <h1> element has been omitted. QUESTION: What must I do to get everything after ようそう!to appear? Roddy
  12. Error 500 - Probable Causes

    JSG: No, i have never messed with the error reporting of the php.ini file. At most I have changed dynamically the destination of the error reporting from display to error log. What is more, contrary to your belief, I do not regularly suppress the display of error settings until after I am sure that I have addressed all warnings, notices, and error messages to the best of my ability. in an effort to salvage my local server I have requested my web server host, Lunarpages, to provide me with a copy of their php.ini file so that I can discover what they have changed and better understand how to modify my own php.ini file. In any case, the design flaws that you have pointed out and that have rendered my local server dysfunctional in the new environment will have to be dealt with in the second phase of development -- not this one. I must begin podcast and newsletter production as quickly as possible. Roddy
  13. Error 500 - Probable Causes

    DSONESUK: Yes, I agree. It seem strange that an AJAX call of POST type would accept a query string of GET-type, but this is exactly what it does. The idea came from StackOverflow, and as I did not know how to write POST-type data, I tried it. This is surely not the source of the problem. In retrospect it is worth citing the jQuery manual in this regard -- namely, "An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0. Apparently, jQuery negotiates the protocol with the PHP file to which the AJAX makes its request. In any case, thank your for teaching me how to write a POST request manually. JSG: My installation is not a prepackaged stack. Rather, it is an improvisation of the software that comes with Apple's operating system. Right now, i am considering about reverting to the old php.ini file, or at least mimicking it as best I can in the new file. My gosh, I do not have time to redo over 20 PHP files when I am so close to completing the first phase of my development. I can accommodate Matomo by modifying the online files that function perfectly well in their current environment. Besides, if everything goes well, I will purchase new equipment and will have to upgrade to PHP 7+ whatever, anyway. In fact, just responding to your recommendation has convinced me that this is the best approach under the current circumstances. For the moment, I simply do not have the time to go back and redo every single file to meet the new PHP demands. There are over 20 files that will likely require some sort of adjustment, and it is already clear that each file will have its own peculiar adjustment needs. INGOLME: Yes, I understand, but the browser tells me nothing other than a failed header that my application does not even require, if only I could solve the problem created by the PHP upgrade. ____________________ Alas, I have decided. I will complete all further modifications of my web-application online until I can afford new equipment and am better positioned to go back and redo everything to meet PHP's new demands. This is a strategic decision that includes that goes beyond code design. Roddy
  14. Error 500 - Probable Causes

    JSG: Under the assumption that all three of the Apache logs are usually placed in the same folder, I am looking in the right place. I say this because there are other sources of unrelated error reported in the same log files. Following your suggestion the PHP info file also reveals the same address. Alas, there are no error messages other than Error Code 500! INGOLME: I rewrote the console.log(message); statement in the AJAX success function as follows: console.log('This the message that does not display: ' + message); Even this did not appear. Roddy
  15. Error 500 - Probable Causes