PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
sowmya_ganesh
Forum Newbie
Posts: 8 Joined: Tue Nov 18, 2003 11:51 pm
Location: India
Post
by sowmya_ganesh » Fri Dec 26, 2003 12:48 am
Please help me
i got data from mysql like below
$rsSize= mysql_query ($sSql);
while($rsSizeRow = mysql_fetch_array($rsSize))
this will give all roww one by one
but i want to get a perticualr row in array ?
say i want to take a row by using rand ?
how it is possible ?
psl help me
aquila125
Forum Commoner
Posts: 96 Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium
Post
by aquila125 » Fri Dec 26, 2003 1:45 am
If you just want a random row from the database use this:
SELECT ..... FROM table_name WHERE ... ORDER BY rand() LIMIT 0,1
it will give you 1 row, selected randomly