Simple question (I think).
I have the below PHP / MySQL script:
$risksql="select risk from jobsrisks where job='$job'";
$executerisks=mysql_query($risksql);
$test=mysql_fetch_array($executerisks);
$riskrows=mysql_num_rows($executerisks);
I want to print the values of the array (for testing), with code:
print_r($test);
This produces the below output:

The query, in php actually outputs 3 records, not just one that is repeated. Any ideas whay I am doing incorrectly? where are the other records and why not in the array? is mysql_fetch_array the correct code to use?
I then want to then use the PHP array in another mysql query:
$ids = join(',',$test);
$sql = "SELECT * FROM table WHERE risk IN ($ids)";
Would this then be correct?
Help is appreciated as always.
Thanks, R
mysql_*functions. They're being deprecated. Instead use PDO (supported as of PHP 5.1) or mysqli (supported as of PHP 4.1). If you're not sure which one to use, read this article.mysql_query. This kind of code will eventually get you fired.