[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 12-18-2005, 02:11 AM   #1 (permalink)
SQLdumpster.com
 
miseria's Avatar
 
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 545
205.50 NP$ (Donate)

miseria will become famous soon enoughmiseria will become famous soon enough


PHP - Random number selector

Ello. I am offering 50 NP$ to anyone who can give me a PHP/MySQL script which will:

- Select the data from a MySQL database
- Take the numbers from the 'x' row
- and then display a random name from the table according to probability of the 'x'.

Sorry, I know that isn't too clear. Basically, there is a table with rows 'x' and 'name'. If one entry (Jim) in the database has '50' in the 'x' row , and another (Paul) has '1'. The script is 50 times more likely to display 'Jim's' results.

Sorry, I know that isn't too clear. very tired
__________________
!!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!!
Free Databases for your Website | All Things Playstation 3
Website Design Books | Music While You Work? | Computer Gadgets
miseria is offline  
Old 12-18-2005, 05:25 AM   #2 (permalink)
mch
NamePros Regular
 
Join Date: Nov 2005
Location: EU
Posts: 248
99.25 NP$ (Donate)

mch is on a distinguished road


I can't give you the script but I found an MSSQL script that might help.
http://www.sqlteam.com/item.asp?ItemID=802
mch is offline  
Old 12-18-2005, 06:56 AM   #3 (permalink)
SQLdumpster.com
 
miseria's Avatar
 
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 545
205.50 NP$ (Donate)

miseria will become famous soon enoughmiseria will become famous soon enough


Thanks. However, I was looking for a MYSQL script rather than MSSQL.

I am developing something myself instead, and I just need to know how I can find all of the 'id's in a table. (For example, if I delete a row). I could use mysql_numrows, but it may include id's which do not exist. For example, it will select id's 1-50, but I may have deleted row #40.
__________________
!!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!!
Free Databases for your Website | All Things Playstation 3
Website Design Books | Music While You Work? | Computer Gadgets
miseria is offline  
Old 12-18-2005, 07:41 AM   #4 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


Quote:
The script is 50 times more likely to display 'Jim's' results.
does that mean that ur table is a frequency table? or is the number just an id?
nasaboy007 is offline  
Old 12-18-2005, 10:14 AM   #5 (permalink)
SQLdumpster.com
 
miseria's Avatar
 
Join Date: Jun 2005
Location: West Sussex, UK
Posts: 545
205.50 NP$ (Donate)

miseria will become famous soon enoughmiseria will become famous soon enough


The number is just an id
__________________
!!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!!
Free Databases for your Website | All Things Playstation 3
Website Design Books | Music While You Work? | Computer Gadgets
miseria is offline  
Old 12-18-2005, 04:44 PM   #6 (permalink)
jdk
Senior Member
 
jdk's Avatar
 
Join Date: Jul 2004
Location: Florida
Posts: 1,223
306.40 NP$ (Donate)

jdk is a name known to alljdk is a name known to alljdk is a name known to alljdk is a name known to alljdk is a name known to alljdk is a name known to all


Can you clarify what you are looking for so I can help?
__________________
All bids are valid for 24 hours unless otherwise stated.
jdk is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Great Scripts for Sale With Resale Rights! Zeeble Scripts For Sale 20 01-04-2006 01:39 AM
Googlism - What does google think of you? deadserious The Break Room 55 12-15-2005 09:09 AM
appraise please Complete Hostings Domain Appraisals 2 01-19-2005 03:03 PM

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 12:53 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85