note 93992 added to function.array-rand
| From: | alagirivimal dot k at netaxis dot in | Date: | Sat, 10 Oct 2009 09:38:40 +0000 |
| Subject: | note 93992 added to function.array-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161619@lists.php.net to get a copy of this message | ||
Random Value Display For Product Page
<?php
$mainid=1;
$main_sql_query = "SELECT * FROM
funpicture_detail WHERE
funpicture_id='$mainid'";
$main_sql_execute = mysql_query($main_sql_query);
$main_sql_count = @mysql_num_rows($main_sql_execute);
if($main_sql_count>0)
{
$main_sql_fetch = mysql_fetch_array($main_sql_execute);
$picid = $main_sql_fetch['pic_id'];
echo "<p>";
echo "Product Name:" . $main_sql_fetch['itname'];
echo "</p>";
echo "<p>";
echo "Product Random Items:";
echo "</p>";
$random_sql_query = "SELECT * FROM funpicture_detail WHERE
funpicture_id!='$mainid' AND itname!='' AND
pic_id='$picid'";
$random_sql_execute = mysql_query($random_sql_query);
$random_sql_count = @mysql_num_rows($random_sql_execute);
if($random_sql_count>0)
{
$array_random = array();
while($random_sql_fetch = mysql_fetch_array($random_sql_execute))
{
$funid = $random_sql_fetch['funpicture_id'];
$funname = $random_sql_fetch['itname'];
$array_random[$funid] = $funname;
}
$rand_keys = array_rand($array_random, 10);
print_r($rand_keys);
}
}
else
{
echo "Invalid Main Id,Check Main Id";
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 125.17.109.94
----
Manual Page -- http://www.php.net/manual/en/function.array-rand.php
Edit -- https://master.php.net/note/edit/93992
Del: integrated -- https://master.php.net/note/delete/93992/integrated
Del: useless -- https://master.php.net/note/delete/93992/useless
Del: bad code -- https://master.php.net/note/delete/93992/bad+code
Del: spam -- https://master.php.net/note/delete/93992/spam
Del: non-english -- https://master.php.net/note/delete/93992/non-english
Del: in docs -- https://master.php.net/note/delete/93992/in+docs
Del: other reasons-- https://master.php.net/note/delete/93992
Reject -- https://master.php.net/note/reject/93992
Search -- https://master.php.net/manage/user-notes.php