<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Question2Answer Q&amp;A - Recent questions tagged random</title>
<link>https://www.question2answer.org/qa/tag/random</link>
<description>Powered by Question2Answer</description>
<item>
<title>Is there any other query to generate random questions ?</title>
<link>https://www.question2answer.org/qa/91618/is-there-any-other-query-to-generate-random-questions</link>
<description>

&lt;p&gt;&amp;nbsp;I am changing&amp;nbsp;&lt;strong style=&quot;color:#666666; font-family:Roboto,&amp;quot;Helvetica Neue&amp;quot;,Helvetica,Arial,sans-serif; font-size:14px; font-weight:700; letter-spacing:0.1px&quot;&gt;qa-include/db/selects.php&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;

&lt;p&gt;$sortsql = 'and&amp;nbsp; ^posts.postid &amp;gt;= (SELECT floor( RAND() * ((SELECT MAX(^posts.postid) FROM ^posts)-(SELECT MIN(^posts.postid) FROM ^posts)) + (SELECT MIN(^posts.postid) FROM ^posts)))';//after modify&lt;/p&gt;&lt;/blockquote&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/91618/is-there-any-other-query-to-generate-random-questions</guid>
<pubDate>Sat, 13 Mar 2021 09:33:52 +0000</pubDate>
</item>
<item>
<title>Need help in this code</title>
<link>https://www.question2answer.org/qa/91394/need-help-in-this-code</link>
<description>

&lt;p&gt;&amp;nbsp;&lt;a href=&quot;https://github.com/NoahY/q2a-featured/blob/master/qa-featured-layer.php&quot; rel=&quot;nofollow&quot;&gt;https://github.com/NoahY/q2a-featured/blob/master/qa-featured-layer.php&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;

&lt;p&gt;&amp;lt;?php&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;class qa_html_theme_layer extends qa_html_theme_base {&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;var $featured_questions;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;function doctype(){&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;$featured = qa_db_read_one_assoc( qa_db_query_sub('SELECT * FROM ^posts q INNER JOIN ^posttags t ON q.postid=t.postid INNER JOIN ^words w ON t.wordid=w.wordid WHERE q.type=&quot;Q&quot; AND w.word=$ ORDER BY rand() LIMIT 1', &quot;tag&quot; ));&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;if($featured &amp;amp;&amp;amp; (!$this-&amp;gt;request || $this-&amp;gt;request=='questions') &amp;amp;&amp;amp; !qa_get('sort') &amp;amp;&amp;amp; isset($this-&amp;gt;content['q_list'])) {&lt;/p&gt;

&lt;p&gt;$featured = explode(',',$featured);&lt;/p&gt;

&lt;p&gt;foreach($this-&amp;gt;content['q_list']['qs'] as $idx =&amp;gt; $question) {&lt;/p&gt;

&lt;p&gt;if(in_array($question['raw']['postid'],$featured)) {&lt;/p&gt;

&lt;p&gt;unset($this-&amp;gt;content['q_list']['qs'][$idx]);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;foreach($featured as $id) {&lt;/p&gt;

&lt;p&gt;$userid = qa_get_logged_in_userid();&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;$selectspec=qa_db_posts_basic_selectspec($userid,true);&lt;/p&gt;

&lt;p&gt;$selectspec['source'].=&quot; JOIN (SELECT postid FROM ^posts WHERE postid=$) y ON ^posts.postid=y.postid&quot;;&lt;/p&gt;

&lt;p&gt;$selectspec['arguments'][] = $id;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;$question = qa_db_select_with_pending($selectspec);&lt;/p&gt;

&lt;p&gt;$usershtml=qa_userids_handles_html(qa_any_get_userids_handles($question));&lt;/p&gt;

&lt;p&gt;$options=qa_post_html_defaults('Q');&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;$q_item = qa_any_to_q_html_fields($question[$id], $userid, qa_cookie_get(), $usershtml, null, $options);&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;array_unshift($this-&amp;gt;content['q_list']['qs'],$q_item);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;featured_questions = count($featured);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;qa_html_theme_base::doctype();&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;// theme replacement functions&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;function q_list($q_list) {&lt;/p&gt;

&lt;p&gt;if(isset($q_list['qs']))&lt;/p&gt;

&lt;p&gt;foreach ($q_list['qs'] as $idx =&amp;gt; $q_item)&lt;/p&gt;

&lt;p&gt;if($idx &amp;lt; $this-&amp;gt;featured_questions)&lt;/p&gt;

&lt;p&gt;$q_list['qs'][$idx]['classes'] = @$q_list['qs'][$idx]['classes'].' qa-q-list-item-featured';&lt;/p&gt;

&lt;p&gt;else&lt;/p&gt;

&lt;p&gt;break;&lt;/p&gt;

&lt;p&gt;qa_html_theme_base::q_list($q_list);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;function head_custom() {&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;output('&amp;lt;style&amp;gt;',qa_opt('featured_question_css'),'&amp;lt;/style&amp;gt;');&lt;/p&gt;

&lt;p&gt;qa_html_theme_base::head_custom();&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;: in_array() expects parameter 2 to be array, null given in&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;(720) : eval()'d code&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;&amp;nbsp;on line&amp;nbsp;&lt;/span&gt;&lt;strong&gt;14&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;: in_array() expects parameter 2 to be array, null given in&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&amp;nbsp;: eval()'d code&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;&amp;nbsp;on line&amp;nbsp;&lt;/span&gt;&lt;strong&gt;14&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;: in_array() expects parameter 2 to be array, null given in&lt;/span&gt;&lt;strong&gt;&amp;nbsp;: eval()'d code&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;&amp;nbsp;on line&amp;nbsp;&lt;/span&gt;&lt;strong&gt;14&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;: in_array() expects parameter 2 to be array, null given in&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&amp;nbsp;: eval()'d code&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;&amp;nbsp;on line&amp;nbsp;&lt;/span&gt;&lt;strong&gt;14&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;: in_array() expects parameter 2 to be array, null given in&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&amp;nbsp;: eval()'d code&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;&amp;nbsp;on line&amp;nbsp;&lt;/span&gt;&lt;strong&gt;14&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;: in_array() expects parameter 2 to be array, null given in&lt;/span&gt;&lt;strong&gt;: eval()'d code&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;&amp;nbsp;on line&amp;nbsp;&lt;/span&gt;&lt;strong&gt;14&lt;/strong&gt;
&lt;br&gt;
&lt;br&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;: Invalid argument supplied for foreach() in&amp;nbsp;&lt;/span&gt;&lt;strong&gt;: eval()'d code&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;&amp;nbsp;on line&amp;nbsp;&lt;/span&gt;&lt;strong&gt;18&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Warning&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;: count(): Parameter must be an array or an object that implements Countable in&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&amp;nbsp;: eval()'d code&lt;/strong&gt;&lt;span style=&quot;background-color:#edf0f2; color:#000000; font-family:Roboto,sans-serif; font-size:medium&quot;&gt;&amp;nbsp;on line&amp;nbsp;&lt;/span&gt;&lt;strong&gt;33&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/91394/need-help-in-this-code</guid>
<pubDate>Sat, 06 Mar 2021 10:09:23 +0000</pubDate>
</item>
<item>
<title>Which query should I use to show random questions from particular tag ?</title>
<link>https://www.question2answer.org/qa/91107/which-query-should-use-show-random-questions-from-particular</link>
<description>

&lt;blockquote&gt;

&lt;p&gt;$random_question = qa_db_read_one_assoc( qa_db_query_sub('SELECT * FROM ^posts WHERE type=$ ORDER BY rand() LIMIT 1', 'Q'), true );&lt;/p&gt;&lt;/blockquote&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/91107/which-query-should-use-show-random-questions-from-particular</guid>
<pubDate>Mon, 22 Feb 2021 01:28:45 +0000</pubDate>
</item>
<item>
<title>How can I make a HTML link in which every time when user click it opens a unanswered random question?</title>
<link>https://www.question2answer.org/qa/63964/which-every-when-user-click-opens-unanswered-random-question</link>
<description></description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/63964/which-every-when-user-click-opens-unanswered-random-question</guid>
<pubDate>Tue, 15 May 2018 11:13:22 +0000</pubDate>
</item>
<item>
<title>find unanswered question  in mysql?</title>
<link>https://www.question2answer.org/qa/63502/find-unanswered-question-in-mysql</link>
<description>hello, i am trying to modify random &amp;nbsp;question viewer plugin. But in that plug shows all question. i want to show unanswered random question. there is a query.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;function output_widget() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$random_question = qa_db_read_one_assoc(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qa_db_query_sub('SELECT * FROM ^posts WHERE &amp;nbsp;type=$&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ORDER BY rand()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LIMIT 1',&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'Q'),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;true );&lt;br /&gt;
&lt;br /&gt;
how i can find unanswered question from mysql?&lt;br /&gt;
&lt;br /&gt;
thank you.</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/63502/find-unanswered-question-in-mysql</guid>
<pubDate>Sat, 14 Apr 2018 10:49:23 +0000</pubDate>
</item>
<item>
<title>random post when i click on the link</title>
<link>https://www.question2answer.org/qa/42477/random-post-when-i-click-on-the-link</link>
<description>hello , i need plugin &amp;nbsp;if i click on the link in my askandanswer , go to random post</description>
<category>Plugins</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/42477/random-post-when-i-click-on-the-link</guid>
<pubDate>Thu, 25 Dec 2014 02:52:43 +0000</pubDate>
</item>
<item>
<title>Random Question Widget displays same question multiple times</title>
<link>https://www.question2answer.org/qa/20429/random-question-widget-displays-same-question-multiple-times</link>
<description>

&lt;p&gt;
	&lt;a href=&quot;https://github.com/NoahY/qa-random-question&quot; rel=&quot;nofollow&quot;&gt;Random Question Widget&lt;/a&gt; sometimes displays same question multiple times. Lets say you have set the number of random questions to be 2. From the set of total 5 questions that I had in my db, i repeatedly noticed that the random question plugin displays same question multiple times.&lt;/p&gt;</description>
<category>Plugins</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/20429/random-question-widget-displays-same-question-multiple-times</guid>
<pubDate>Sun, 06 Jan 2013 13:41:04 +0000</pubDate>
</item>
<item>
<title>How can i get random question from database ?</title>
<link>https://www.question2answer.org/qa/8595/how-can-i-get-random-question-from-database</link>
<description>Not really good at PHP/Mysql can someone can help ?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/8595/how-can-i-get-random-question-from-database</guid>
<pubDate>Mon, 22 Aug 2011 13:54:44 +0000</pubDate>
</item>
<item>
<title>How i can get random list of questions ?</title>
<link>https://www.question2answer.org/qa/8472/how-i-can-get-random-list-of-questions</link>
<description>I'm not really good at PHP so how i can get list of random questions or random unanswered questions in widget/plugin ?</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/8472/how-i-can-get-random-list-of-questions</guid>
<pubDate>Fri, 19 Aug 2011 10:02:35 +0000</pubDate>
</item>
</channel>
</rss>