<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>database | Jörg Drzycimski</title>
	<atom:link href="https://drzycimski.com/tag/database/feed/" rel="self" type="application/rss+xml" />
	<link>https://drzycimski.com/tag/database/</link>
	<description></description>
	<lastBuildDate>Sun, 01 Oct 2017 16:54:57 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>No-MVC Zend Framework: Rating Controller / Part VI</title>
		<link>https://drzycimski.com/programmierung/no-mvc-zend-framework-rating-controller-part-vi/</link>
					<comments>https://drzycimski.com/programmierung/no-mvc-zend-framework-rating-controller-part-vi/#respond</comments>
		
		<dc:creator><![CDATA[Jörg]]></dc:creator>
		<pubDate>Sat, 05 Feb 2011 17:49:10 +0000</pubDate>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Action]]></category>
		<category><![CDATA[autoloader]]></category>
		<category><![CDATA[Controller]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[View]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<guid isPermaLink="false">http://blog.drzycimski.com/?p=60</guid>

					<description><![CDATA[<p>The controller is the most important part in this ZF tutorial. This is where most of the PHP code resides. It handles all input &#8211; coming thru the file receiving the Ajax rating &#8211; as well as all output &#8211; e. g. updating the rating scores. The only liberty I took not following the ZF [&#8230;]</p>
<p>The post <a href="https://drzycimski.com/programmierung/no-mvc-zend-framework-rating-controller-part-vi/">No-MVC Zend Framework: Rating Controller / Part VI</a> appeared first on <a href="https://drzycimski.com">Jörg Drzycimski</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The controller is the most important part in this ZF tutorial. This is where most of the PHP code resides. It handles all input &#8211; coming thru the file receiving the Ajax rating &#8211; as well as all output &#8211; e. g. updating the rating scores. The only liberty I took not following the ZF way is to integrate the view scripts (a.k.a. HTML output) into classes in this controller, but you can put these classes anywhere you want if you are using ZF as an application.</p>
<p>If you are familiar with Zend&#8217;s naming conventions, and check the name of the class called in Part IV, you should be able to make an educated guess as to the name of the controller file, and the folder to store it. If not, read the ZF manual on &#8222;autoloading&#8220; 😉 The class name <code>Mylib_Rating_Controller</code> expects a file named &#8222;Controller.php&#8220; in your &#8222;library/Mylib&#8220; folder, subfolder &#8222;Rating&#8220; (you already told Zend to check &#8222;library&#8220; in your bootstrap). Create folders and file, and add the class as well as your first method:</p>
<pre class="brush:php">class Mylib_Rating_Controller
{
 public function __construct($options = null)
 {
 }

 /**
 * Get rating view
 *
 * @params int page id
 * @return string
 */
 public function getRatingView($id)
 {
 $rating = $this-&gt;getRatingById($id);
 if (!empty($rating)) {
  $average = floor($rating-&gt;rating_total / $rating-&gt;rating_votes);
 } else {
  $average = 0;
 }
 ?&gt;
 &lt;select id="&lt;?php echo $id ?&gt;"&gt;
 &lt;option value="1"&lt;?php if ($average == "1") echo ' selected="selected"';?&gt;&gt;Bad&lt;/option&gt;
 &lt;option value="2"&lt;?php if ($average == "2") echo ' selected="selected"';?&gt;&gt;Not too bad&lt;/option&gt;
 &lt;option value="3"&lt;?php if ($average == "3") echo ' selected="selected"';?&gt;&gt;Ok&lt;/option&gt;
 &lt;option value="4"&lt;?php if ($average == "4") echo ' selected="selected"';?&gt;&gt;Good&lt;/option&gt;
 &lt;option value="5"&lt;?php if ($average == "5") echo ' selected="selected"';?&gt;&gt;Terrific&lt;/option&gt;
 &lt;/select&gt;
 &lt;span id="rating_value_&lt;?php echo $id ?&gt;"&gt;&amp;nbsp;&lt;/span&gt;
 &lt;?php
 }
}
</pre>
<p>The post <a href="https://drzycimski.com/programmierung/no-mvc-zend-framework-rating-controller-part-vi/">No-MVC Zend Framework: Rating Controller / Part VI</a> appeared first on <a href="https://drzycimski.com">Jörg Drzycimski</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://drzycimski.com/programmierung/no-mvc-zend-framework-rating-controller-part-vi/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Converting a MySQL database to UTF-8</title>
		<link>https://drzycimski.com/programmierung/converting-a-mysql-database-to-utf-8/</link>
					<comments>https://drzycimski.com/programmierung/converting-a-mysql-database-to-utf-8/#comments</comments>
		
		<dc:creator><![CDATA[Jörg]]></dc:creator>
		<pubDate>Thu, 20 Jan 2011 17:11:45 +0000</pubDate>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[charset]]></category>
		<category><![CDATA[convert database]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[utf-8]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<guid isPermaLink="false">http://www.drzycimski.com/?p=110</guid>

					<description><![CDATA[<p>I just spent about 2 days to convert my old MySQL database from latin1 / latin1_general_ci to UTF-8 character encoding. There are about a gazillion pitfalls, especially when you work on old PHP code mixed with ZF code, on a live site of a client. The first tip is&#8230; do NOT work on a live [&#8230;]</p>
<p>The post <a href="https://drzycimski.com/programmierung/converting-a-mysql-database-to-utf-8/">Converting a MySQL database to UTF-8</a> appeared first on <a href="https://drzycimski.com">Jörg Drzycimski</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I just spent about 2 days to convert my old MySQL database from latin1 / latin1_general_ci to UTF-8 character encoding. There are about a gazillion pitfalls, especially when you work on old PHP code mixed with ZF code, on a live site of a client. The first tip is&#8230; do NOT work on a live site 😉 Backup everything to a local version or a testserver, and then start to code! Fortunately, I had the site including the database on a local XAMPP environment.</p>
<p>For a coarse orientation, you can use the <a href="http://codex.wordpress.org/Converting_Database_Character_Sets">article on wordpress.org</a> to get an overview. There is no way to change the character encoding of an entire database with just a few keystrokes, so expect it to take a tad bit longer.</p>
<p>For me, the following steps did the trick, using <a href="http://www.phpmyadmin.net/" target="_blank" rel="noopener">phpMyAdmin</a> and <a href="http://www.notepad-plus-plus.org/" target="_blank" rel="noopener">Notepad++</a> (on Windows):</p>
<ol>
<li>Create a backup of the entire database with phpMyAdmin.</li>
<li>Change your database to UTF-8 (ALTER DATABASE mydb CHARACTER SET utf8;). This will only affect new tables, so you´re not thru yet.</li>
<li>Select the table(s) to change, and use the export function of phpMyAdmin.</li>
<li>Copy the exported data (INSERT INTO&#8230;) without the header (CREATE&#8230;) into Notepad++.</li>
<li>Change the table´s charset (ALTER TABLE mytable DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;).</li>
<li>Change all fields with latin charsets to utf8_general_ci (e.g. ALTER TABLE mytable CHANGE myfield myfield TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;). Pls note that this SQL only works for TEXT fields, refer to the <a href="http://codex.wordpress.org/Converting_Database_Character_Sets">article on wordpress.org</a> on how to convert ENUM, VARCHARS and so on, or use phpMyAdmin to do so for you. If you have a lot of columns with the same format to convert, just copy&amp;paste one SQL line, and change the column names in each. Paste those lines into phpMyAdmin´s SQL editor, that´s a lot faster than doing it for each column.</li>
<li>By now, you should have the table as well as all columns in UTF-8.</li>
<li>Switch to Notepad++, where all you INSERTs for that table are, and convert those lines to UTF-8.</li>
<li>Copy&amp;paste it into phpMyAdmin´s SQL editor.</li>
<li>Repeat steps 3 to 9 for each table, and you should have your database converted to UTF-8.</li>
</ol>
<p>Now, that took an hour or two ;), but there´s still the website to change to the new encoding.</p>
<p>First, start with your meta tag:</p>
<pre class="brush:html">&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
</pre>
<p>Next up, if applicable, change your database connection script in PHP:</p>
<pre class="brush:php">mysql_set_charset("utf8");
</pre>
<p>And / or if you use Zend Framework, edit your config file:</p>
<pre class="brush:php">database.params.charset = "utf8"
</pre>
<p>and your bootstrap:</p>
<pre class="brush:php">ini_set('default_charset', 'UTF-8');

$view-&gt;setEncoding('UTF-8');
</pre>
<p>That should do the trick, and your entire site runs on UTF-8 instead of latin.</p>
<p>The post <a href="https://drzycimski.com/programmierung/converting-a-mysql-database-to-utf-8/">Converting a MySQL database to UTF-8</a> appeared first on <a href="https://drzycimski.com">Jörg Drzycimski</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://drzycimski.com/programmierung/converting-a-mysql-database-to-utf-8/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>No-MVC Zend Framework: jQuery Ajax receiver / Part V</title>
		<link>https://drzycimski.com/programmierung/no-mvc-zend-framework-jquery-ajax-receiver-part-v/</link>
					<comments>https://drzycimski.com/programmierung/no-mvc-zend-framework-jquery-ajax-receiver-part-v/#respond</comments>
		
		<dc:creator><![CDATA[Jörg]]></dc:creator>
		<pubDate>Tue, 11 May 2010 16:34:31 +0000</pubDate>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Star Rating]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<guid isPermaLink="false">http://blog.drzycimski.com/?p=64</guid>

					<description><![CDATA[<p>The jQuery JavaScript is up and running, but needs a PHP file to handle the Ajax data submitted by the rating script. This will be done with PHP in the receiver you defined in your JavaScript, named &#8222;rating.php&#8220; in the &#8222;public/includes&#8220; folder. It&#8217;s important to put this PHP file in your public folder, because if [&#8230;]</p>
<p>The post <a href="https://drzycimski.com/programmierung/no-mvc-zend-framework-jquery-ajax-receiver-part-v/">No-MVC Zend Framework: jQuery Ajax receiver / Part V</a> appeared first on <a href="https://drzycimski.com">Jörg Drzycimski</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The jQuery JavaScript is up and running, but needs a PHP file to handle the Ajax data submitted by the rating script. This will be done with PHP in the receiver you defined in your JavaScript, named &#8222;rating.php&#8220; in the &#8222;public/includes&#8220; folder. It&#8217;s important to put this PHP file in your public folder, because if you pointed your webserver to &#8222;public&#8220;, anything outside (subfolders of  your document root) can&#8217;t be accessed by JavaScript.</p>
<p>Create the &#8222;rating.php&#8220;, and add the following lines:</p>
<pre class="brush:php">&lt;?php
require_once('bootstrap.php'); // Setup Zend Framework Environment
header("Cache-Control: no-cache");
$rating = new Mylib_Rating_Controller();
$score = $rating-&gt;setRatingById($_GET['id'], $_GET['val']); // rate object and get scores
echo Zend_Json::encode($score); // send response array in JSON format
?&gt;
</pre>
<p>The <code>setRatingById</code> passes the values from your JavaScript to the (soon to be created) controller, and receives the updated values from your (soon to be created) database. When I started out using jQuery in combination with Ajax, I was kind of afraid to find it difficult&#8230; but it really<em> is </em>that easy 😉</p>
<p>Next up: The rating controller</p>
<p>The post <a href="https://drzycimski.com/programmierung/no-mvc-zend-framework-jquery-ajax-receiver-part-v/">No-MVC Zend Framework: jQuery Ajax receiver / Part V</a> appeared first on <a href="https://drzycimski.com">Jörg Drzycimski</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://drzycimski.com/programmierung/no-mvc-zend-framework-jquery-ajax-receiver-part-v/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>No-MVC Zend Framework: Installing ZF &#038; jQuery / Part II</title>
		<link>https://drzycimski.com/programmierung/zend-framework-without-mvc-part-ii/</link>
					<comments>https://drzycimski.com/programmierung/zend-framework-without-mvc-part-ii/#respond</comments>
		
		<dc:creator><![CDATA[Jörg]]></dc:creator>
		<pubDate>Sun, 02 May 2010 11:34:30 +0000</pubDate>
				<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQueryUI]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Star Rating]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<guid isPermaLink="false">http://blog.drzycimski.com/?p=36</guid>

					<description><![CDATA[<p>My tutorial of utilizing Zend Framework without MVC will be a jQuery rating controller, with ZF used to query the database, spit out the view (the actual stars), and handle rating changes thru Ajax, updating the DB. Though I prefer not to use ZF as an application, I tried to program as close to the [&#8230;]</p>
<p>The post <a href="https://drzycimski.com/programmierung/zend-framework-without-mvc-part-ii/">No-MVC Zend Framework: Installing ZF &#038; jQuery / Part II</a> appeared first on <a href="https://drzycimski.com">Jörg Drzycimski</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>My tutorial of utilizing Zend Framework without MVC will be a jQuery rating controller, with ZF used to query the database, spit out the view (the actual stars), and handle rating changes thru Ajax, updating the DB. Though I prefer not to use ZF as an application, I tried to program as close to the MVC structure as possible. If you&#8217;re using ZF already, you will see that my way of utilizing it is close to a ZF plugin resource &#8211; with some minor changes, you&#8217;ll be able to adapt it into the framework in no time at all.</p>
<p><strong>Installing Zend Framework</strong></p>
<p>On your server, add some directories to accomodate ZF, jQuery, and your own PHP files. Assuming that you start from scratch, you need to point your webserver to the &#8222;public&#8220; directory, instead of  &#8222;document root&#8220;. This way, one can&#8217;t access your lib files, e.g. configs, by URL.</p>
<pre>&gt; document root
  &gt; library
    &gt; Mylib
    &gt; Zend
  &gt; public
     &gt; images
     &gt; includes
     &gt; js
       &gt; jquery</pre>
<p>Download the lastest ZF version at <a href="http://framework.zend.com/download/latest" target="_blank" rel="noopener">http://framework.zend.com/download/latest</a>, and unpack the files. Get the content of the &#8222;library/Zend&#8220; form your archive, and copy it into the &#8222;library/Zend&#8220; folder on your server. Next, get the latest of jQueryUI at <a href="http://jqueryui.com/download" target="_blank" rel="noopener">http://jqueryui.com/download</a>, and put the content in the &#8222;jquery&#8220; folder. jQueryUI is just a nice JavaScript framework (that word again&#8230;) with widgets and effects&#8230; you might need them later 😉</p>
<p>A short note: though ZF supports the <a href="http://www.dojotoolkit.org" target="_blank" rel="noopener">Dojo</a> JavaScript framework, I personally prefer jQuery. Dojo definetly has the cooler widgets, but the support sucks&#8230; no forum to speak of, and mailing list support slow if ever. If you run into problems with Dojo, you&#8217;re basically on your own&#8230; the exact opposite of jQuery, where you 1. get support within hours, and 2. rarely run into problems to begin with 😉 Just my 2 cents&#8230;</p>
<p>Anyway, the part missing for our little tutorial is the Star Rating plugin for jQuery. Get it at <a href="http://zensoftware.org/archives/483" target="_blank" rel="noopener">http://zensoftware.org/archives/483</a>, and put it in your &#8222;js&#8220; folder, into a &#8222;rating&#8220; subdirectory.</p>
<p>Next up: Bootstrapping ZF</p>
<p>The post <a href="https://drzycimski.com/programmierung/zend-framework-without-mvc-part-ii/">No-MVC Zend Framework: Installing ZF &#038; jQuery / Part II</a> appeared first on <a href="https://drzycimski.com">Jörg Drzycimski</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://drzycimski.com/programmierung/zend-framework-without-mvc-part-ii/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
