Thank you very much LordShryku and Drawmack !!
For those interested here is my working test code:
<?
session_start();
$db_name ="table_name";
$connection = @mysql_connect("****","****","****") or die(mysql_error());
$db = mysql_select_db($db_name,$connection)or die(mysql_error());
$sql = "select productId from products where proIspecial ='y'";
$result = @mysql_query($sql,$connection) or die(mysql_error());
$num = @mysql_num_rows($result);
// This prints out the amount of IDs found that are on special startong from 1 to what ever.
$display = "The number of product on special $num";
// Since arrays start at 0 created a value of the amount $num - 1
$numbr = $num - 1 ;
$display .= "<br>";
// This prints out the value of $numbr which is the reult of $num - 1
$display .= "The number for the array $numbr since array start at 0<p>";
if ($num < 1) {
$display .= "No products on special none";
} else {
// This sets $randm_id to an array which was the whole key to my issue
$randm_id = array();
while ($row = mysql_fetch_array($result)){
// This is to pull the IDs out to be able to display them, is not really needed for anything other then to check the the right values are being used by the array_rand()
$test_num = $row['productId'];
// This sets the results of the while loop to and array, again the above part - for $test_num - and below part - for print $test_num - can be omitted
$randm_id[] = $row['productId'];
// This prints out all of the IDs that were found to be on special.
$display .= "$test_num<br>";
}
}
$rand_keys = array_rand($randm_id,$numbr);
$display .= "<p>";
$display .= $randm_id[$rand_keys[0]];
?>
<?print "$display";?>
Thanks,
troinfo