note 93992 deleted from function.array-rand by danbrown

From: Date: Sat, 10 Oct 2009 21:00:32 +0000
Subject: note 93992 deleted from function.array-rand by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161627@lists.php.net to get a copy of this message
Note Submitter: alagirivimal dot k at netaxis dot in ---- 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"; } ?>

« previous php.notes (#161627) next »