<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1043441" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1043441</link>
    <description></description>
    <language>en</language>
          <item>
    <title>greg wrote:
Problem is it</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/wordpress-additional-db-table-and-code#comment-1239875</link>
    <description> &lt;p&gt;&lt;div class=&quot;quote-msg&quot;&gt;&lt;div class=&quot;quote-author&quot;&gt;&lt;em&gt;greg&lt;/em&gt; wrote:&lt;/div&gt;Problem is it creates a load of vars that will never get used.&lt;br /&gt;
&lt;strong&gt;Same would apply with putting all quotes in an array and choosing a random key number.&lt;br /&gt;
&lt;/strong&gt;&lt;/div&gt;I know how to work with arrays, that&#039;s not the issue. Either variables or an array will have a huge amount of data in it, and only a tiny amount used.&lt;/p&gt;
&lt;p&gt;Quotes will be 150 chars max, and eventually I will have hundreds of quotes.&lt;br /&gt;
I don&#039;t want to set a huge array or hundreds of variables for only one quote.&lt;/p&gt;
&lt;p&gt;So for example, with only FOUR quotes&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$array &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= array(&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;Do not worry about your difficulties in Mathematics. &lt;br /&gt;I can assure you mine are still greater&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;I know not with what weapons World War III will be fought, but &lt;br /&gt;World War IV will be fought with sticks and stones&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;As far as the laws of mathematics refer to reality, they are not &lt;br /&gt;certain; and as far as they are certain, they do not refer to reality&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;The significant problems we have cannot be solved at the same level of &lt;br /&gt;thinking with which we created them&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;As I will actually only USE one, even 4 looks nasty and inefficient, with hundreds of quotes and hundreds of visitors, I wouldn&#039;t like to think about the resource usages. &lt;/p&gt;
&lt;p&gt;This cannot be the most efficient way to do this.&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 Mar 2009 15:52:00 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1239875 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Something like this would be</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/wordpress-additional-db-table-and-code#comment-1239876</link>
    <description> &lt;p&gt;Something like this would be best.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//set quotes&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$quotes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[] = &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;first quote&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$quotes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[] = &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;second quote&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$quotes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[] = &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;third quote&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// get the random element index&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$index &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;array_rand&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$quotes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//print chosen var&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;print &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$quotes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$index&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;];&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;To add another quote, just add another element to the array:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$quotes&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[] = &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;fourth quote&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Edit: so you mention that you will have hundreds...maybe a table would be the best option.  &lt;a href=&quot;http://codex.wordpress.org/Function_Reference/wpdb_Class&quot;&gt;This page&lt;/a&gt; will help you with interacting with the Wordpress database.&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 Mar 2009 15:52:00 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1239876 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>instead of separate</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/wordpress-additional-db-table-and-code#comment-1239872</link>
    <description> &lt;p&gt;instead of separate variables you could create an array from a single text variable string containing all the quotes using explode()&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$str &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;Hello world. It&#039;s a beautiful day.&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;print_r &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;explode&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;));&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The output of the code above will be:Array&lt;br /&gt;(&lt;br /&gt;[0] =&amp;gt; Hello&lt;br /&gt;[1] =&amp;gt; world.&lt;br /&gt;[2] =&amp;gt; It&amp;#039;s&lt;br /&gt;[3] =&amp;gt; a&lt;br /&gt;[4] =&amp;gt; beautiful&lt;br /&gt;[5] =&amp;gt; day.&lt;br /&gt;)&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;[HINT] make your separator an unusual character such as a pipe &quot;|&quot;&lt;/p&gt;
&lt;p&gt;You could use also use array_rand():&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;?php&lt;br /&gt;$a=array(&amp;quot;a&amp;quot;=&amp;gt;&amp;quot;Dog&amp;quot;,&amp;quot;b&amp;quot;=&amp;gt;&amp;quot;Cat&amp;quot;,&amp;quot;c&amp;quot;=&amp;gt;&amp;quot;Horse&amp;quot;);&lt;br /&gt;print_r(array_rand($a,1));&lt;br /&gt;?&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 Mar 2009 15:24:56 +0000</pubDate>
 <dc:creator>decibel.places</dc:creator>
 <guid isPermaLink="false">comment 1239872 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Yeah, you&#039;re both right.
And</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/wordpress-additional-db-table-and-code#comment-1239859</link>
    <description> &lt;p&gt;Yeah, you&#039;re both right.&lt;/p&gt;
&lt;p&gt;And it makes it a million times easier too.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;EDIT&lt;br /&gt;
hmm.&lt;/p&gt;
&lt;p&gt;How would I have a bunch of quotes with a reference to each allowing a random one to be selected from them?&lt;br /&gt;
I thought of a var for each quote i.e.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//set random&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$total_quote &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$number_chosen &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;rand&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$total_quote&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;); &lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//set quotes&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$quote_1 &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;first quote&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$quote_2 &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;second quote&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$quote_3 &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;third quote&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//print chosen var&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;print ${&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;quote_&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$number_chosen&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;};&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Problem is it creates a load of vars that will never get used.&lt;br /&gt;
Same would apply with putting all quotes in an array and choosing a random key number.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 Mar 2009 11:27:00 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1239859 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I agree - the database is</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/wordpress-additional-db-table-and-code#comment-1239857</link>
    <description> &lt;p&gt;I agree - the database is probably not needed, unless you want to change the quotes in the admin area or something.  See if you have the plugin &quot;Hello Dolly&quot; in your Wordpress installation.  This is meant to serve as a sample plugin, but it also displays random phrases like you are trying to do.&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 Mar 2009 09:55:11 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1239857 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>if all you&#039;re doing is</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/wordpress-additional-db-table-and-code#comment-1239847</link>
    <description> &lt;p&gt;if all you&#039;re doing is storing a list of quotes (text) why bother with a db at all?&lt;/p&gt;
&lt;p&gt;use PHP to read/write to a flat file, load the file with PHP include or JavaScript, randomly pick a line/member, bingo!&lt;/p&gt;
&lt;p&gt;something along the lines of my &lt;a href=&quot;http://www.webmaster-forums.net/projects/event-links-list-scrollable-div-no-scrollbars-plus-admin-without-database&quot;&gt;links admin&lt;/a&gt;, but much much simpler!&lt;/p&gt;
 </description>
     <pubDate>Fri, 27 Mar 2009 04:24:00 +0000</pubDate>
 <dc:creator>decibel.places</dc:creator>
 <guid isPermaLink="false">comment 1239847 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
