vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Query help (https://vborg.vbsupport.ru/showthread.php?t=49676)

geniuscrew 03-05-2003 07:57 PM

Yup that's right Boofo :)

Erwin 03-05-2003 08:02 PM

Use this:

PHP Code:

$quot=$DB_site->query_first("SELECT quotesid,quote,name FROM quotes ORDER BY quotesid DESC LIMIT 1"); 


Boofo 03-05-2003 08:06 PM

Quote:

Originally posted by Erwin
Use this:

PHP Code:

$quot=$DB_site->query_first("SELECT quotesid,quote,name FROM quotes ORDER BY quotesid DESC LIMIT 1"); 


I was close. I forgot to do the first quotesid (actually I didn't know it had to be done that way). ;)

Let me know how it works, geniuscrew.

geniuscrew 03-05-2003 09:09 PM

Actually Boofo even though you didn't say, I was putting the id bit in the SELECT part [at the beginning] ;)

Still it's only showing the last quote. :/

Erwin 03-05-2003 09:50 PM

That is because that is what you wanted. The query chooses the very last quote listed.

Change DESC to ASC will make it choose the first quote listed. But it will not be random. It will always choose the first quote, or last quote.

geniuscrew 03-05-2003 10:02 PM

So there's no way of making it go through the list of quotes and display them one by one?

If not how do i make it even more random?

Thanks for the help guys.

Boofo 03-05-2003 10:26 PM

Quote:

Originally posted by geniuscrew
So there's no way of making it go through the list of quotes and display them one by one?

If not how do i make it even more random?

Thanks for the help guys.

Use RAND(NOW()) in place of RAND like I posted earlier in the thread. The NOW() supplies the necessary seed for the newer versions of mySQL. Trust me. It works. ;)

mr e 03-05-2003 10:26 PM

you could add another column that would display if it's been listed yet, not sure how to make it more random though

geniuscrew 03-05-2003 10:38 PM

Mr E: But would that let the same quote be used twice?

Boofo: Is that the most randomest of randoms? :) I did try it before ya know and it worked, but wasn't what I was looking for. But I'll use it :P


Thanks ppl.

Boofo 03-05-2003 10:49 PM

According to the mySQL site, that is more random than the old way (with RAND() alone) ever was. The seed needs to be there now and this is the automatic way to do it. It's all I use anymore and I have noticed a world of difference. But then I have over 642 quotes, so that helps. I use this for the member of the day hack and it makes a big difference there, too. Try it for a few days and let me know what you think. You will be amazed. ;)


All times are GMT. The time now is 12:46 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00987 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete