<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1022319" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1022319</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/two-questions-generating-random-user#comment-1137602</link>
    <description> &lt;p&gt;i &lt;em&gt;think&lt;/em&gt; i understand what&#039;s happening. i&#039;d like to make sure i &lt;strong&gt;do&lt;/strong&gt; understand what&#039;s happening there.&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: SELECT &lt;em&gt;fields&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;selects the feilds i want to display&lt;br /&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;Quote: FROM users&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt; means to search by the users table&lt;br /&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;Quote: INNER JOIN stats ON users.uid=stats.uid&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;means to synchronise based on the uid fields&lt;br /&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;Quote: ORDER BY rand()&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;makes it randomly take the users on the ... for lack of a better way to think of it, the temporary table it made&lt;br /&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;Quote: LIMIT 1&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;makes it take just one of them.&lt;/p&gt;
&lt;p&gt;i&#039;ve never used a join before, or the rand function, which is why i want to make sure i understand what&#039;s going on&lt;/p&gt;
&lt;p&gt;sorry about asking more questions, it&#039;s just how i do things with programming/scripting. when i ask for help, if i&#039;m using things that are new to me i break it down and verify that i&#039;m understanding each part, so that i know i&#039;ll be learning what&#039;s goingon correctly. then i can help others in the future&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Sep 2003 01:00:34 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1137602 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/two-questions-generating-random-user#comment-1137600</link>
    <description> &lt;p&gt;SELECT users.gender,stats.dob,stats.sex_pref,stats.mar_stat,stats.country&lt;br /&gt;
FROM users&lt;br /&gt;
INNER JOIN stats ON users.uid=stats.uid&lt;br /&gt;
ORDER BY rand()&lt;br /&gt;
LIMIT 1&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Sep 2003 00:19:44 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1137600 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/two-questions-generating-random-user#comment-1137599</link>
    <description> &lt;p&gt;shane: i have a database with user id numbers assigned when you sign up.&lt;/p&gt;
&lt;p&gt;some people may delete, some may be deleted. this leaves holes.&lt;/p&gt;
&lt;p&gt;for the front page i want to seelct a user at random and pull some information for a section.&lt;/p&gt;
&lt;p&gt;so i want to pull a randome user between 1 and an unknown maximum.&lt;/p&gt;
&lt;p&gt;i&#039;m hoping to find a way to do this so that it&#039;ll change the user displayed with each load of the index.&lt;/p&gt;
 </description>
     <pubDate>Thu, 11 Sep 2003 00:05:20 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1137599 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/two-questions-generating-random-user#comment-1137592</link>
    <description> &lt;p&gt;Not sure why you want to generate a random ID, and not a somewhat sequential index with AUTO_INCREMENT , this will eliminate the HUMAN error aspect and always generate a unique ID.&lt;/p&gt;
&lt;p&gt;In answer to your query results: $result[&#039;fieldname&#039;]&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: SELECT * FROM users ORDER BY rand() LIMIT 1&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;?? This will only select a random user, if he uses that ID whats to say its not 3, and someone is #4, then he would be given an error is he made it a unique field, or he would have two entries under the same ID.&lt;/p&gt;
&lt;p&gt;To get your last highest ID&lt;/p&gt;
&lt;p&gt;SELECT id FROM users ORDER BY id DESC LIMIT 1&lt;/p&gt;
 </description>
     <pubDate>Wed, 10 Sep 2003 20:51:52 +0000</pubDate>
 <dc:creator>ShaneS</dc:creator>
 <guid isPermaLink="false">comment 1137592 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/two-questions-generating-random-user#comment-1137584</link>
    <description> &lt;p&gt;SELECT * FROM users ORDER BY rand() LIMIT 1&lt;/p&gt;
 </description>
     <pubDate>Wed, 10 Sep 2003 19:49:56 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1137584 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
