Jump to content

dmeade

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.davidmeade.com

Profile Information

  • Gender
    Not Telling
  • Location
    Chicago

dmeade's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks Hal! Combining several of the ideas from that thread I managed to come up with a good solution: [php:1:981219069a]<?php $random_seed=rand(1, time()); $query = \"SELECT * FROM $table ORDER BY RAND($random_seed) limit 1\"; ?>[/php:1:981219069a] Thanks again. - Dave
  2. thanks to the information above I managed to get a good solution: [php:1:d09dd98aa6]<?php $random_seed=rand(1, time()); $query = \"SELECT * FROM $table ORDER BY RAND($random_seed) limit 1\"; ?>[/php:1:d09dd98aa6] Thanks all. - Dave
  3. I have a bizarre problem and would greatly appreciate any help. I am administering several web sites. On each I have installed the same mySQL databases and PHP code, on servers which are similarly configured. However the code is behaving differently on each domain. I\'m trying to use \"ORDER BY RAND() limit 1\" to retrieve a random record. On \"Domain A\" this is working flawlessly. On \"Domain B\" it appears to work once and a (very great) while -- but almost never. And, on \"Domain C\" this rarely works at all. Each domain has the following set up: domainA.com PHP version = 4.2.1 mySQL version = 3.23.54 table = 110 records Apache Version = 1.3.24 (Unix) domainB.com PHP version = 4.2.1 mySQL version = 3.23.54 table = 78 records Apache Version = 1.3.24 (Unix) domainC.com PHP version = 4.2.1 mySQL version = 3.23.54 table = 45 record Apache Version = 1.3.26 (Unix) And each domain has the following table definition: CREATE TABLE Quote_Board ( Quote_ID int(11) NOT NULL auto_increment, Quote text NOT NULL, Person text NOT NULL, URL text, Type set(\'Spoken\',\'IM\',\'Email\',\'Other\') default \'Spoken\', Submitted_by text, Quote_Date date default NULL, Submission_Date date default NULL, approved enum(\'Y\',\'N\') NOT NULL default \'N\', PRIMARY KEY (Quote_ID) ) TYPE=MyISAM; And each domain is using the following PHP code: $query = "SELECT * FROM `Quote_Board` WHERE approved = \'Y\' ORDER BY RAND() limit 1"; $result = mysql_query($query) or die("Query failed"); while ($quote = mysql_fetch_array($result, MYSQL_BOTH)) { // print resutls in HTML } mysql_free_result($result); I just can\'t figure out why it is working so well on one domain and so poorly on the other. Thanks in advance for any help, Dave
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.