Germaris Posted September 9, 2007 Share Posted September 9, 2007 Greetings! How should I proceed to make a random search in all the tables (or a given one) of a MySQL DB? The variable sent may be a string or a number. It's the kind of search we find on the first page of many websites... Many thanks in advance for any tip !!! Quote Link to comment https://forums.phpfreaks.com/topic/68618-solved-perform-a-random-search/ Share on other sites More sharing options...
Psycho Posted September 9, 2007 Share Posted September 9, 2007 I don't understand your request. Perhaps you are looking for the MySQL RAND() function. SELECT * FROM table ORDER BY RAND() LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/68618-solved-perform-a-random-search/#findComment-344883 Share on other sites More sharing options...
Germaris Posted September 9, 2007 Author Share Posted September 9, 2007 Very simple... Say I want to find the string "earth" in a search performed through all the fields of three different tables: table1, table2 and table3. Same search for the number "012345"... Quote Link to comment https://forums.phpfreaks.com/topic/68618-solved-perform-a-random-search/#findComment-344889 Share on other sites More sharing options...
Psycho Posted September 9, 2007 Share Posted September 9, 2007 That would be a "Full text search" http://www.phpfreaks.com/tutorials/129/0.php Quote Link to comment https://forums.phpfreaks.com/topic/68618-solved-perform-a-random-search/#findComment-344922 Share on other sites More sharing options...
Germaris Posted September 9, 2007 Author Share Posted September 9, 2007 Oh yes! You're right, this seems absolutely appropriate! Thank you very much. Best regards Quote Link to comment https://forums.phpfreaks.com/topic/68618-solved-perform-a-random-search/#findComment-344930 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.