iwato

Members
  • Content count

    664
  • Joined

  • Last visited

  • Days Won

    1

iwato last won the day on June 10

iwato had the most liked content!

Community Reputation

6 Neutral

1 Follower

About iwato

  • Rank
    Invested Member

Previous Fields

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

Contact Methods

  • AIM
    moogoonghwa
  • Website URL
    http://www.grammarcaptive.com
  • Yahoo
    iddor
  • Skype
    kiusau

Profile Information

  • Gender
    Male
  • Location
    Seattle, Washington USA 98104

Recent Profile Visitors

3,580 profile views
  1. OK. This is the code. I am exhausted. <?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $host = "..."; $user = "..."; $pwd = "..."; $mysqli_obj = new mysqli($host, $user, $pwd); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $mysqli_obj->set_charset("utf8"); $db = "thege0_grammarcaptive"; $mysqli_obj->select_db($db); $tbl_name = 'rss2_podcast_channel'; $sql_1 = "SELECT * FROM ". $tbl_name . " ORDER BY channel_pubdate DESC LIMIT 1"; $chan_arr = array(); $result_obj = $mysqli_obj->query($sql_1); while($row = $result_obj->fetch_assoc()) { foreach($row as $key => $value) { $chan_arr[$key] = $value; } } $tbl_name = 'rss2_podcast_item'; $sql_1 = "SELECT * FROM ". $tbl_name . " ORDER BY item_pubdate DESC LIMIT 5"; $item_arr = array(); $result_obj = $mysqli_obj->query($sql_1); while($row = $result_obj->fetch_assoc()) { foreach($row as $key => $value) { $item_arr[$key] = $value; } $items[] = $item_arr; } $tbl_name = 'rss2_podcast_itunes'; $sql_1 = "SELECT * FROM ". $tbl_name . " ORDER BY publish_date_itunes DESC LIMIT 5"; $itunes_arr = array(); $result_obj = $mysqli_obj->query($sql_1); while($row = $result_obj->fetch_assoc()) { foreach($row as $key => $value) { $itunes_arr[$key] = $value; } $itunes[] = $itunes_arr; } include('/Users/kiusau/Sites/reflexive/php_practice/libraries/rssgen2.0/rss_generator.inc.php'); $rss_feed = new rssGenerator_rss(); $atomLinkHref = '../../../../grammarcaptive.com/feed/gc_podcasts.xml'; $chan_categories = array(0 => array('domain' => '', 'name' => $chan_arr['channel_category1']),1 => array('domain' => '', 'name' => $chan_arr['channel_category2']),2 => array('domain' => '', 'name' => $chan_arr['channel_category3'])); $i = 0; $length = count($items); while ($i < $length) { foreach ($items[$i] as $key => $value) { if ($key == 'item_category1') { $item_categories[$i][$key] = array('domain'=>'','name'=>$value); } if ($key == 'item_category2') { $item_categories[$i][$key] = array('domain'=>'','name'=>$value); } if ($key == 'item_category3') { $item_categories[$i][$key] = array('domain'=>'','name'=>$value); } } $i++; } $i = 0; $length = count($itunes); while ($i < $length) { foreach ($itunes[$i] as $key => $value) { if ($key == 'itunes_category1') { $itunes_categories[$i][$key] = array('domain'=>'','name'=>$value); } if ($key == 'itunes_category2') { $itunes_categories[$i][$key] = array('domain'=>'','name'=>$value); } if ($key == 'itunes_category3') { $itunes_categories[$i][$key] = array('domain'=>'','name'=>$value); } } $i++; } $i = 0; $length = count($items); while ($i < $length) { $rss_item = new rssGenerator_item(); foreach ($items[$i] as $key => $value) { $rss_item->title = $items[$i]['item_title']; $rss_item->description = $items[$i]['item_description']; $rss_item->link = $items[$i]['item_link']; $rss_item->pubDate = $items[$i]['item_pubdate']; $rss_item->author = $items[$i]['item_author']; $rss_item->comments = $items[$i]['item_comments']; $rss_item->guid = $items[$i]['item_guid']; $rss_item->guid_isPermaLink = 'false'; $rss_item->source = 'Grammar Captive'; $rss_item->source_url = $items[$i]['item_source']; $rss_item->enclosure_url = $items[$i]['item_enclurl']; $rss_item->enclosure_length = $items[$i]['item_encllength']; $rss_item->enclosure_type = $items[$i]['item_encltype']; $rss_item->categories = $item_categories[$i]; } $rss_items[] = $rss_item; $i++; } $rss_image = new rssGenerator_image(); $rss_image->title = $chan_arr['channel_img_title']; $rss_image->url = $chan_arr['channel_img_url']; $rss_image->link = $chan_arr['channel_img_link']; $rss_image->width = $chan_arr['channel_img_width']; $rss_image->height = $chan_arr['channel_img_height']; $rss_image->description = $chan_arr['channel_img_description']; $rss_channel = new rssGenerator_channel(); $rss_channel->atomLinkHref = $atomLinkHref; $rss_channel->title = $chan_arr['channel_title']; $rss_channel->link = $chan_arr['channel_link']; $rss_channel->description = $rss_feed->cData($chan_arr['channel_description']); $rss_channel->language = $chan_arr['channel_language']; $rss_channel->copyright = $chan_arr['channel_copyright']; $rss_channel->webMaster = $chan_arr['channel_link']; $rss_channel->pubDate = $chan_arr['channel_pubdate']; $rss_channel->lastBuildDate = $chan_arr['channel_lastbuilddate']; $rss_channel->categories = $chan_categories; $rss_channel->image = $rss_image; $rss_channel->items = $rss_items; $rss_feed->encoding = 'UTF-8'; $rss_feed->version = '2.0'; $rss_feed->createFeed($rss_channel); // header('Location: gc_podcasts.xml'); $result_obj->free(); $mysqli_obj->close(); ?> Now, mind you. This identical code works in an HTML file with all kinds of HTML mark-up, but when set aside unto its own without the mark-up it fails resulting in the PHP white sheet.
  2. BACKGROUND: I have recently created the content of an automatically generated podcast using a PHP Class that I found on a webpage found https://www.phpclasses.org/package/2957-PHP-Generate-RSS-2-0-feeds.html. Unfortunately, when I attempt to display the generated feed all that is displayed are the values of the input variables, or alternatively nothing (see (below)depending on the method of display. In short, the desired formatting -- the reason that I downloaded the PHP Class -- is missing. The page that creates the above result is a text file with a .php extension and a header( ) function. $rss_feed->encoding = 'UTF-8'; $rss_feed->version = '2.0'; $rss_feed->createFeed($rss_channel); header('Content-Type: text/xml; $rss_channel = the object that combines the formatting with the values of the input variables and their respective objects. The Class is relatively straight-forward and easily customized, but for two lines that I do not understand and could well be preventing the display of the XML code, if not properly configured. Interestingly, whether they are commented out or left in tact, they have no affect on what is displayed. $selfUrl = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on' ? 'http://' : 'https://'); $selfUrl .= $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; When I run the .php file the following message appears at the top of the completed page. Still nothing below the message appears. Also, I do not know the source of this message. it does not appear to come from the .php document. Now, I have not constructed a style-sheet for the Feed page, but I hardly see how this could stop the feed from appearingl Please advise.
  3. This problem has been resolved. After a night's rest I discovered that I was accidentally querying the same table twice. A condition likely caused by an improper copy and paste. LESSON: When everything appears correct, do not doubt its correctness. Look elsewhere for the error.
  4. Please ignore the missing back-tick before the obs column. it was a typo incurred while editing code taken from the results of a SHOW CREATE TABLE statement.
  5. Thank you. I will add these links to my notes. Roddy
  6. This is what I thought too, but it does not appear to run.
  7. QUESTION ONE: How does one suppress duplicate row entries? QUESTION TWO: In the following case what is causing them to occur? BACKGROUND: I created several tables only to discover that they were not as I wanted them. AFter truncateng each, I dropped what I believed to be poorly structured columns, rearranged some, and added still others. When I tested the result, everything worked great except for one problem -- a single table entry reuslted in duplicate rows. THE TABLE STRUCTURE CREATE TABLE 'table_name' (obs` int(5) NOT NULL AUTO_INCREMENT . . . PRIMARY KEY (`obs`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 A SAMPLE SQL STATEMENT INSERT INTO rss2_podcast_itunes (podcast_no_itunes, itunes_category1, itunes_category2, itunes_category3, itunes_complete, itunes_new_feed_url, itunes_name, itunes_email, itunes_duration, itunes_order, itunes_author, itunes_block, itunes_image, itunes_explicit, itunes_summary) VALUES ('54', 'education', 'language', 'English', '', '', 'Roddy A. Stegemann', 'kiusau@me.com', '00:01:01', '', 'Roddy A. Stegemann', '', 'http://www.grammarcaptive.com/_images/captive.png', '', 'Test') Please note the following: No value is entered for the obs field/column. The auto increment advances one for each row entered. Below each successfully loaded row entry appears another row identical in every way but one -- the appearance of an incremental advance in the value of the obs field. Please advise. Roddy
  8. JSG - Up until now I have understood that a Javascript script can be entered via an <input> or <textarea> control form, or for that matter any other data that is passed from a form to the same or another processing page when the <submit> control is triggered. What you seem to be suggesting is something else. Am I in error? If not, could you provide an example. I would like to see what i am up against. Roddy
  9. I have never heard of a static class -- only static properties and methods of a class. Do you mean by non-static class a class without static properties or methods? If I have understood correctly, the purpose of the pseudo $this variable is to distinguish between variables within a specific scope or class from regular variables -- these latter being variable that can be used anywhere except within a class or specified scope. In effect, one can speak of three different kinds of variables: 1) regular variables -- variables defined and used outside of specific scopes and classes. 2) $this -> variables -- variables defined within a specific scope or class and accessed from within the scope or class using the $this-> notation of from without using a class object and the -> operator. 3) global variables -- variables defined within a specific scope (not class) that can be accessed from without the scope as regular variables and presumably within the scope as same. Is this assessment correct? Have you anything to add?
  10. Are you saying then that the object, because it is an object is global in nature, and that, if created outside of the function, the same object can be accessed either in or outside of the function?
  11. Not really. In both cases it is documentation. Although it may be more likely that documentation included with the code is more current than documentation that is external to the code, either could be neglected with regard to an update of the code. Still, there is no sample code, and the implementation of htcacheclear on the UNIX terminal is unclear.
  12. Dsonesuk: I am still a little confused by this statement The condition is true when AJAX is absent, but false when it is present. So, if AJAX is present, ajax_comment.php' will be called, and if AJAX is absent config.php is called. As we do not know what is contained in config.php, it is difficult to know why there would be two different PHP pages to process the same code. Does this make sense to you? Loois: Could you show us config.php? JSG: OK. I appear to understand that sanitization, perhaps not validation, should always take place on the server side. And, in the event that the user has turned Javascript off, one would also want to sanitize on the server-side. What I am unclear about is the nature of the manipulation of the Javascript. Can the user actually rewrite the author's Javascript? Or, is it that the user submits his own Javascript as input data that takes advantage of the Javascript that the author has written?
  13. OK. The advantage of using AJAX is to prevent having to reload the page each time the form is submitted, and the advantage of using PHP is to insure that the submitted data is sanitized and validated. Are implying with this that it is not possible to use Javascript for the purpose of sanitization and validation? If I have understood correctly, AJAX serves only as an intermediary between the form page and the PHP page. In other words, the PHP page should be written, as if the AJAX did not exist, and the AJAX should always refer to the PHP page via the following piece of code $.ajax({ url: 'ajax_comment.php', What is more, the PHP code should only be included in the page, if the following condition is satisfied. !isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) Thus, it was wrong for Loois to have included the following code at the bottom of his form page include ("jquery.js"); Under the assumption that all of the above is correct, why is the following code not entered at the top of the form page? include ("jquery.js"); My very best, Roddy
  14. Yes. In other words, it is telling me that it is there, but that I am not employing it properly.